aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-12-03 11:54:46 -0800
committerKazu Hirata <kazu@google.com>2022-12-03 11:54:46 -0800
commit5891420e6848e86a069dc6b7b73f175e22388f4a (patch)
tree99d82aa1d75dbd2abc6df791b87c384c49277431 /clang/lib/Lex/ModuleMap.cpp
parent0c2f6e36f9b2d26a2665e38a76ae8a95c158c4c7 (diff)
downloadllvm-5891420e6848e86a069dc6b7b73f175e22388f4a.zip
llvm-5891420e6848e86a069dc6b7b73f175e22388f4a.tar.gz
llvm-5891420e6848e86a069dc6b7b73f175e22388f4a.tar.bz2
[clang] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 4e86c5c..b66d95d 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -189,7 +189,7 @@ Optional<FileEntryRef> ModuleMap::findHeader(
expectedToOptional(SourceMgr.getFileManager().getFileRef(Filename));
if (!File || (Header.Size && File->getSize() != *Header.Size) ||
(Header.ModTime && File->getModificationTime() != *Header.ModTime))
- return None;
+ return std::nullopt;
return *File;
};
@@ -247,7 +247,7 @@ Optional<FileEntryRef> ModuleMap::findHeader(
<< Header.FileName << M->getFullModuleName();
NeedsFramework = true;
}
- return None;
+ return std::nullopt;
}
return NormalHdrFile;
@@ -482,7 +482,7 @@ void ModuleMap::diagnoseHeaderInclusion(Module *RequestingModule,
if (RequestingModule) {
resolveUses(RequestingModule, /*Complain=*/false);
- resolveHeaderDirectives(RequestingModule, /*File=*/llvm::None);
+ resolveHeaderDirectives(RequestingModule, /*File=*/std::nullopt);
}
bool Excluded = false;
@@ -690,7 +690,7 @@ ModuleMap::findAllModulesForHeader(const FileEntry *File) {
if (findOrCreateModuleForHeaderInUmbrellaDir(File))
return Headers.find(File)->second;
- return None;
+ return std::nullopt;
}
ArrayRef<ModuleMap::KnownHeader>
@@ -699,7 +699,7 @@ ModuleMap::findResolvedModulesForHeader(const FileEntry *File) const {
resolveHeaderDirectives(File);
auto It = Headers.find(File);
if (It == Headers.end())
- return None;
+ return std::nullopt;
return It->second;
}
@@ -1262,7 +1262,7 @@ void ModuleMap::addHeader(Module *Mod, Module::Header Header,
Optional<FileEntryRef>
ModuleMap::getContainingModuleMapFile(const Module *Module) const {
if (Module->DefinitionLoc.isInvalid())
- return None;
+ return std::nullopt;
return SourceMgr.getFileEntryRefForID(
SourceMgr.getFileID(Module->DefinitionLoc));