diff options
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
| -rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index c4906e9aa3e..cba00a40ce6 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -611,6 +611,8 @@ const FileEntry *Preprocessor::LookupFile( SmallVectorImpl<char> *RelativePath, ModuleMap::KnownHeader *SuggestedModule, bool SkipCache) { + Module *RequestingModule = getModuleForLocation(FilenameLoc); + // If the header lookup mechanism may be relative to the current inclusion // stack, record the parent #includes. SmallVector<std::pair<const FileEntry *, const DirectoryEntry *>, 16> @@ -664,8 +666,8 @@ const FileEntry *Preprocessor::LookupFile( const DirectoryLookup *TmpFromDir = nullptr; while (const FileEntry *FE = HeaderInfo.LookupFile( Filename, FilenameLoc, isAngled, TmpFromDir, TmpCurDir, - Includers, SearchPath, RelativePath, SuggestedModule, - SkipCache)) { + Includers, SearchPath, RelativePath, RequestingModule, + SuggestedModule, SkipCache)) { // Keep looking as if this file did a #include_next. TmpFromDir = TmpCurDir; ++TmpFromDir; @@ -681,11 +683,11 @@ const FileEntry *Preprocessor::LookupFile( // Do a standard file entry lookup. const FileEntry *FE = HeaderInfo.LookupFile( Filename, FilenameLoc, isAngled, FromDir, CurDir, Includers, SearchPath, - RelativePath, SuggestedModule, SkipCache); + RelativePath, RequestingModule, SuggestedModule, SkipCache); if (FE) { if (SuggestedModule && !LangOpts.AsmPreprocessor) HeaderInfo.getModuleMap().diagnoseHeaderInclusion( - getModuleForLocation(FilenameLoc), FilenameLoc, Filename, FE); + RequestingModule, FilenameLoc, Filename, FE); return FE; } @@ -697,10 +699,11 @@ const FileEntry *Preprocessor::LookupFile( if ((CurFileEnt = SourceMgr.getFileEntryForID(CurPPLexer->getFileID()))) { if ((FE = HeaderInfo.LookupSubframeworkHeader(Filename, CurFileEnt, SearchPath, RelativePath, + RequestingModule, SuggestedModule))) { if (SuggestedModule && !LangOpts.AsmPreprocessor) HeaderInfo.getModuleMap().diagnoseHeaderInclusion( - getModuleForLocation(FilenameLoc), FilenameLoc, Filename, FE); + RequestingModule, FilenameLoc, Filename, FE); return FE; } } @@ -713,10 +716,10 @@ const FileEntry *Preprocessor::LookupFile( SourceMgr.getFileEntryForID(ISEntry.ThePPLexer->getFileID()))) { if ((FE = HeaderInfo.LookupSubframeworkHeader( Filename, CurFileEnt, SearchPath, RelativePath, - SuggestedModule))) { + RequestingModule, SuggestedModule))) { if (SuggestedModule && !LangOpts.AsmPreprocessor) HeaderInfo.getModuleMap().diagnoseHeaderInclusion( - getModuleForLocation(FilenameLoc), FilenameLoc, Filename, FE); + RequestingModule, FilenameLoc, Filename, FE); return FE; } } |

