From 5891420e6848e86a069dc6b7b73f175e22388f4a Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 3 Dec 2022 11:54:46 -0800 Subject: [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 --- clang/lib/Lex/ModuleMap.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'clang/lib/Lex/ModuleMap.cpp') 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 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 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 @@ -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 ModuleMap::getContainingModuleMapFile(const Module *Module) const { if (Module->DefinitionLoc.isInvalid()) - return None; + return std::nullopt; return SourceMgr.getFileEntryRefForID( SourceMgr.getFileID(Module->DefinitionLoc)); -- cgit v1.1