diff --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h index cec3a31c94800..347c4ecd29341 100644 --- a/clang/include/clang/Lex/HeaderSearch.h +++ b/clang/include/clang/Lex/HeaderSearch.h @@ -501,7 +501,7 @@ class HeaderSearch { /// HIToolbox is a subframework within Carbon.framework. If so, return /// the FileEntry for the designated file, otherwise return null. OptionalFileEntryRef LookupSubframeworkHeader( - StringRef Filename, const FileEntry *ContextFileEnt, + StringRef Filename, FileEntryRef ContextFileEnt, SmallVectorImpl *SearchPath, SmallVectorImpl *RelativePath, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule); diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index 83ed2a991d2bd..e7195cbe91413 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -1178,11 +1178,9 @@ OptionalFileEntryRef HeaderSearch::LookupFile( /// is a subframework within Carbon.framework. If so, return the FileEntry /// for the designated file, otherwise return null. OptionalFileEntryRef HeaderSearch::LookupSubframeworkHeader( - StringRef Filename, const FileEntry *ContextFileEnt, + StringRef Filename, FileEntryRef ContextFileEnt, SmallVectorImpl *SearchPath, SmallVectorImpl *RelativePath, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule) { - assert(ContextFileEnt && "No context file?"); - // Framework names must have a '/' in the filename. Find it. // FIXME: Should we permit '\' on Windows? size_t SlashPos = Filename.find('/'); @@ -1190,7 +1188,7 @@ OptionalFileEntryRef HeaderSearch::LookupSubframeworkHeader( return std::nullopt; // Look up the base framework name of the ContextFileEnt. - StringRef ContextName = ContextFileEnt->getName(); + StringRef ContextName = ContextFileEnt.getName(); // If the context info wasn't a framework, couldn't be a subframework. const unsigned DotFrameworkLen = 10; diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 7bb4dd3bc7eb6..7edcb0577c2b2 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1041,14 +1041,14 @@ OptionalFileEntryRef Preprocessor::LookupFile( return FE; } - const FileEntry *CurFileEnt; + OptionalFileEntryRef CurFileEnt; // Otherwise, see if this is a subframework header. If so, this is relative // to one of the headers on the #include stack. Walk the list of the current // headers on the #include stack and pass them to HeaderInfo. if (IsFileLexer()) { if ((CurFileEnt = CurPPLexer->getFileEntry())) { if (OptionalFileEntryRef FE = HeaderInfo.LookupSubframeworkHeader( - Filename, CurFileEnt, SearchPath, RelativePath, RequestingModule, + Filename, *CurFileEnt, SearchPath, RelativePath, RequestingModule, SuggestedModule)) { if (SuggestedModule && !LangOpts.AsmPreprocessor) HeaderInfo.getModuleMap().diagnoseHeaderInclusion( @@ -1063,7 +1063,7 @@ OptionalFileEntryRef Preprocessor::LookupFile( if (IsFileLexer(ISEntry)) { if ((CurFileEnt = ISEntry.ThePPLexer->getFileEntry())) { if (OptionalFileEntryRef FE = HeaderInfo.LookupSubframeworkHeader( - Filename, CurFileEnt, SearchPath, RelativePath, + Filename, *CurFileEnt, SearchPath, RelativePath, RequestingModule, SuggestedModule)) { if (SuggestedModule && !LangOpts.AsmPreprocessor) HeaderInfo.getModuleMap().diagnoseHeaderInclusion(