Migrate llvm::Optional to std::optional

LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
This commit is contained in:
Ben Barham
2024-02-02 22:19:39 -08:00
parent d3d4bd203c
commit ef8825bfe6
810 changed files with 8035 additions and 8718 deletions

View File

@@ -1060,11 +1060,11 @@ bool ModuleFileSharedCore::readCommentBlock(llvm::BitstreamCursor &cursor) {
return false;
}
static llvm::Optional<swift::LibraryKind>
static std::optional<swift::LibraryKind>
getActualLibraryKind(unsigned rawKind) {
auto stableKind = static_cast<serialization::LibraryKind>(rawKind);
if (stableKind != rawKind)
return llvm::None;
return std::nullopt;
switch (stableKind) {
case serialization::LibraryKind::Library:
@@ -1074,10 +1074,10 @@ getActualLibraryKind(unsigned rawKind) {
}
// If there's a new case value in the module file, ignore it.
return llvm::None;
return std::nullopt;
}
static llvm::Optional<ModuleDecl::ImportFilterKind>
static std::optional<ModuleDecl::ImportFilterKind>
getActualImportControl(unsigned rawValue) {
// We switch on the raw value rather than the enum in order to handle future
// values.
@@ -1093,7 +1093,7 @@ getActualImportControl(unsigned rawValue) {
case static_cast<unsigned>(serialization::ImportControl::PackageOnly):
return ModuleDecl::ImportFilterKind::PackageOnly;
default:
return llvm::None;
return std::nullopt;
}
}