diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2020-10-20 18:11:52 -0400 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2020-11-02 15:11:51 -0500 |
commit | 9f151df17800e1668c32e5314a290ae94c8f2dd3 (patch) | |
tree | b70b98d362d280fd92d1477efe66b5b8af11c75b /clang/lib/Serialization/ModuleManager.cpp | |
parent | c29513f7e023f125c6d221db179dc40b79e5c074 (diff) | |
download | llvm-9f151df17800e1668c32e5314a290ae94c8f2dd3.zip llvm-9f151df17800e1668c32e5314a290ae94c8f2dd3.tar.gz llvm-9f151df17800e1668c32e5314a290ae94c8f2dd3.tar.bz2 |
Change Module::ASTFile and ModuleFile::File => Optional<FileEntryRef>, NFC
Change `Module::ASTFile` and `ModuleFile::File` to use
`Optional<FileEntryRef>` instead of `const FileEntry *`. One of many
steps toward removing `FileEntry::getName`.
Differential Revision: https://reviews.llvm.org/D89836
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index 2c65c0b..40ffa6c 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -112,7 +112,7 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, // Look for the file entry. This only fails if the expected size or // modification time differ. - const FileEntry *Entry; + OptionalFileEntryRefDegradesToFileEntryPtr Entry; if (Type == MK_ExplicitModule || Type == MK_PrebuiltModule) { // If we're not expecting to pull this file out of the module cache, it // might have a different mtime due to being moved across filesystems in @@ -288,7 +288,7 @@ void ModuleManager::removeModules(ModuleIterator First, ModuleMap *modMap) { if (modMap) { StringRef ModuleName = victim->ModuleName; if (Module *mod = modMap->findModule(ModuleName)) { - mod->setASTFile(nullptr); + mod->setASTFile(None); } } } @@ -458,18 +458,18 @@ void ModuleManager::visit(llvm::function_ref<bool(ModuleFile &M)> Visitor, returnVisitState(State); } -bool ModuleManager::lookupModuleFile(StringRef FileName, - off_t ExpectedSize, +bool ModuleManager::lookupModuleFile(StringRef FileName, off_t ExpectedSize, time_t ExpectedModTime, - const FileEntry *&File) { - File = nullptr; + Optional<FileEntryRef> &File) { + File = None; if (FileName == "-") return false; // Open the file immediately to ensure there is no race between stat'ing and // opening the file. - auto FileOrErr = FileMgr.getFile(FileName, /*OpenFile=*/true, - /*CacheFailure=*/false); + Optional<FileEntryRef> FileOrErr = + expectedToOptional(FileMgr.getFileRef(FileName, /*OpenFile=*/true, + /*CacheFailure=*/false)); if (!FileOrErr) return false; |