diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/Lex/ModuleMap.h | 9 | ||||
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Lex/ModuleMap.cpp | 10 |
3 files changed, 14 insertions, 13 deletions
diff --git a/clang/include/clang/Lex/ModuleMap.h b/clang/include/clang/Lex/ModuleMap.h index 0da1cdc..086b37a 100644 --- a/clang/include/clang/Lex/ModuleMap.h +++ b/clang/include/clang/Lex/ModuleMap.h @@ -259,8 +259,8 @@ private: Attributes Attrs; /// If \c InferModules is non-zero, the module map file that allowed - /// inferred modules. Otherwise, nullptr. - const FileEntry *ModuleMapFile; + /// inferred modules. Otherwise, nullopt. + OptionalFileEntryRef ModuleMapFile; /// The names of modules that cannot be inferred within this /// directory. @@ -275,7 +275,8 @@ private: /// A mapping from an inferred module to the module map that allowed the /// inference. - llvm::DenseMap<const Module *, const FileEntry *> InferredModuleAllowedBy; + // FIXME: Consider making the values non-optional. + llvm::DenseMap<const Module *, OptionalFileEntryRef> InferredModuleAllowedBy; llvm::DenseMap<const Module *, AdditionalModMapsSet> AdditionalModMaps; @@ -631,7 +632,7 @@ public: /// getContainingModuleMapFile(). OptionalFileEntryRef getModuleMapFileForUniquing(const Module *M) const; - void setInferredModuleAllowedBy(Module *M, const FileEntry *ModMap); + void setInferredModuleAllowedBy(Module *M, OptionalFileEntryRef ModMap); /// Canonicalize \p Path in a manner suitable for a module map file. In /// particular, this canonicalizes the parent directory separately from the diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 7912ff0..ada86b0 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -525,15 +525,15 @@ static Module *prepareToBuildModule(CompilerInstance &CI, StringRef OriginalModuleMapName = CI.getFrontendOpts().OriginalModuleMap; if (!OriginalModuleMapName.empty()) { auto OriginalModuleMap = - CI.getFileManager().getFile(OriginalModuleMapName, - /*openFile*/ true); + CI.getFileManager().getOptionalFileRef(OriginalModuleMapName, + /*openFile*/ true); if (!OriginalModuleMap) { CI.getDiagnostics().Report(diag::err_module_map_not_found) << OriginalModuleMapName; return nullptr; } - if (*OriginalModuleMap != CI.getSourceManager().getFileEntryForID( - CI.getSourceManager().getMainFileID())) { + if (*OriginalModuleMap != CI.getSourceManager().getFileEntryRefForID( + CI.getSourceManager().getMainFileID())) { M->IsInferred = true; CI.getPreprocessor().getHeaderSearchInfo().getModuleMap() .setInferredModuleAllowedBy(M, *OriginalModuleMap); diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index b4483cd..bee3a48 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -622,7 +622,7 @@ ModuleMap::findOrCreateModuleForHeaderInUmbrellaDir(FileEntryRef File) { UmbrellaModule = UmbrellaModule->Parent; if (UmbrellaModule->InferSubmodules) { - OptionalFileEntryRefDegradesToFileEntryPtr UmbrellaModuleMap = + OptionalFileEntryRef UmbrellaModuleMap = getModuleMapFileForUniquing(UmbrellaModule); // Infer submodules for each of the directories we found between @@ -993,7 +993,7 @@ Module *ModuleMap::inferFrameworkModule(DirectoryEntryRef FrameworkDir, // If the framework has a parent path from which we're allowed to infer // a framework module, do so. - const FileEntry *ModuleMapFile = nullptr; + OptionalFileEntryRef ModuleMapFile; if (!Parent) { // Determine whether we're allowed to infer a module map. bool canInfer = false; @@ -1294,13 +1294,13 @@ OptionalFileEntryRef ModuleMap::getModuleMapFileForUniquing(const Module *M) const { if (M->IsInferred) { assert(InferredModuleAllowedBy.count(M) && "missing inferred module map"); - // FIXME: Update InferredModuleAllowedBy to use FileEntryRef. - return InferredModuleAllowedBy.find(M)->second->getLastRef(); + return InferredModuleAllowedBy.find(M)->second; } return getContainingModuleMapFile(M); } -void ModuleMap::setInferredModuleAllowedBy(Module *M, const FileEntry *ModMap) { +void ModuleMap::setInferredModuleAllowedBy(Module *M, + OptionalFileEntryRef ModMap) { assert(M->IsInferred && "module not inferred"); InferredModuleAllowedBy[M] = ModMap; } |