diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2020-12-09 14:46:34 -0800 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2020-12-14 14:35:11 -0800 |
commit | a40db5502b2515a6f2f1676b5d7a655ae0f41179 (patch) | |
tree | f304102fc337f5a49d983fcec1a05b8dd973ec5b /clang/lib/Lex/ModuleMap.cpp | |
parent | 25067f179f33ba1b764ac7a7d83385c8fd73801f (diff) | |
download | llvm-a40db5502b2515a6f2f1676b5d7a655ae0f41179.zip llvm-a40db5502b2515a6f2f1676b5d7a655ae0f41179.tar.gz llvm-a40db5502b2515a6f2f1676b5d7a655ae0f41179.tar.bz2 |
Lex: Migrate HeaderSearch::LoadedModuleMaps to FileEntryRef
Migrate `HeaderSearch::LoadedModuleMaps` and a number of APIs over to
`FileEntryRef`. This should have no functionality change. Note that two
`FileEntryRef`s hash the same if they point at the same `FileEntry`.
Differential Revision: https://reviews.llvm.org/D92975
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r-- | clang/lib/Lex/ModuleMap.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index bbda1f1..152fc9e 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -973,9 +973,9 @@ Module *ModuleMap::inferFrameworkModule(const DirectoryEntry *FrameworkDir, // We haven't looked here before. Load a module map, if there is // one. bool IsFrameworkDir = Parent.endswith(".framework"); - if (const FileEntry *ModMapFile = - HeaderInfo.lookupModuleMapFile(*ParentDir, IsFrameworkDir)) { - parseModuleMapFile(ModMapFile, Attrs.IsSystem, *ParentDir); + if (Optional<FileEntryRef> ModMapFile = + HeaderInfo.lookupModuleMapFile(*ParentDir, IsFrameworkDir)) { + parseModuleMapFile(*ModMapFile, Attrs.IsSystem, *ParentDir); inferred = InferredDirectories.find(*ParentDir); } @@ -2163,12 +2163,12 @@ void ModuleMapParser::parseExternModuleDecl() { llvm::sys::path::append(ModuleMapFileName, FileName); FileNameRef = ModuleMapFileName; } - if (auto File = SourceMgr.getFileManager().getFile(FileNameRef)) + if (auto File = SourceMgr.getFileManager().getOptionalFileRef(FileNameRef)) Map.parseModuleMapFile( *File, /*IsSystem=*/false, Map.HeaderInfo.getHeaderSearchOpts().ModuleMapFileHomeIsCwd ? Directory - : (*File)->getDir(), + : File->getDir(), FileID(), nullptr, ExternLoc); } @@ -2984,7 +2984,7 @@ bool ModuleMapParser::parseModuleMapFile() { } while (true); } -bool ModuleMap::parseModuleMapFile(const FileEntry *File, bool IsSystem, +bool ModuleMap::parseModuleMapFile(FileEntryRef File, bool IsSystem, const DirectoryEntry *Dir, FileID ID, unsigned *Offset, SourceLocation ExternModuleLoc) { |