diff --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h index 2e9c1f0329cf6..533de59c5a061 100644 --- a/clang/include/clang/Lex/HeaderSearch.h +++ b/clang/include/clang/Lex/HeaderSearch.h @@ -677,7 +677,7 @@ class HeaderSearch { /// Like \ref findAllModulesForHeader, but do not attempt to infer module /// ownership from umbrella headers if we've not already done so. ArrayRef - findResolvedModulesForHeader(const FileEntry *File) const; + findResolvedModulesForHeader(FileEntryRef File) const; /// Read the contents of the given module map file. /// diff --git a/clang/include/clang/Lex/ModuleMap.h b/clang/include/clang/Lex/ModuleMap.h index 494baf0e57b3b..8b1ae6944f320 100644 --- a/clang/include/clang/Lex/ModuleMap.h +++ b/clang/include/clang/Lex/ModuleMap.h @@ -199,8 +199,7 @@ class ModuleMap { private: friend class ModuleMapParser; - using HeadersMap = - llvm::DenseMap>; + using HeadersMap = llvm::DenseMap>; /// Mapping from each header to the module that owns the contents of /// that header. @@ -357,7 +356,7 @@ class ModuleMap { /// If \p File represents a builtin header within Clang's builtin include /// directory, this also loads all of the module maps to see if it will get /// associated with a specific module (e.g. in /usr/include). - HeadersMap::iterator findKnownHeader(const FileEntry *File); + HeadersMap::iterator findKnownHeader(FileEntryRef File); /// Searches for a module whose umbrella directory contains \p File. /// @@ -451,8 +450,7 @@ class ModuleMap { /// Like \ref findAllModulesForHeader, but do not attempt to infer module /// ownership from umbrella headers if we've not already done so. - ArrayRef - findResolvedModulesForHeader(const FileEntry *File) const; + ArrayRef findResolvedModulesForHeader(FileEntryRef File) const; /// Resolve all lazy header directives for the specified file. /// diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index 4deabf2c49bb8..fc23bbf839334 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -1576,7 +1576,7 @@ HeaderSearch::findAllModulesForHeader(FileEntryRef File) const { } ArrayRef -HeaderSearch::findResolvedModulesForHeader(const FileEntry *File) const { +HeaderSearch::findResolvedModulesForHeader(FileEntryRef File) const { if (ExternalSource) { // Make sure the external source has handled header info about this file, // which includes whether the file is part of a module. diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 4dcd9118cbf71..4d93a2d79be72 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -417,8 +417,7 @@ bool ModuleMap::isBuiltinHeader(const FileEntry *File) { isBuiltinHeaderName(llvm::sys::path::filename(File->getName())); } -ModuleMap::HeadersMap::iterator -ModuleMap::findKnownHeader(const FileEntry *File) { +ModuleMap::HeadersMap::iterator ModuleMap::findKnownHeader(FileEntryRef File) { resolveHeaderDirectives(File); HeadersMap::iterator Known = Headers.find(File); if (HeaderInfo.getHeaderSearchOpts().ImplicitModuleMaps && @@ -711,7 +710,7 @@ ModuleMap::findAllModulesForHeader(FileEntryRef File) { } ArrayRef -ModuleMap::findResolvedModulesForHeader(const FileEntry *File) const { +ModuleMap::findResolvedModulesForHeader(FileEntryRef File) const { // FIXME: Is this necessary? resolveHeaderDirectives(File); auto It = Headers.find(File); @@ -927,9 +926,9 @@ Module *ModuleMap::createModuleForInterfaceUnit(SourceLocation Loc, // Mark the main source file as being within the newly-created module so that // declarations and macros are properly visibility-restricted to it. - auto *MainFile = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID()); + auto MainFile = SourceMgr.getFileEntryRefForID(SourceMgr.getMainFileID()); assert(MainFile && "no input file for module interface"); - Headers[MainFile].push_back(KnownHeader(Result, PrivateHeader)); + Headers[*MainFile].push_back(KnownHeader(Result, PrivateHeader)); return Result; } @@ -1373,7 +1372,7 @@ LLVM_DUMP_METHOD void ModuleMap::dump() { llvm::errs() << "Headers:"; for (HeadersMap::iterator H = Headers.begin(), HEnd = Headers.end(); H != HEnd; ++H) { - llvm::errs() << " \"" << H->first->getName() << "\" -> "; + llvm::errs() << " \"" << H->first.getName() << "\" -> "; for (SmallVectorImpl::const_iterator I = H->second.begin(), E = H->second.end(); I != E; ++I) {