akhuang updated this revision to Diff 366344. akhuang added a comment. undo previous change
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107921/new/ https://reviews.llvm.org/D107921 Files: clang/lib/Lex/HeaderSearch.cpp Index: clang/lib/Lex/HeaderSearch.cpp =================================================================== --- clang/lib/Lex/HeaderSearch.cpp +++ clang/lib/Lex/HeaderSearch.cpp @@ -819,9 +819,19 @@ bool IncluderIsSystemHeader = Includer ? getFileInfo(Includer).DirInfo != SrcMgr::C_User : BuildSystemModule; - if (Optional<FileEntryRef> FE = getFileAndSuggestModule( - TmpDir, IncludeLoc, IncluderAndDir.second, IncluderIsSystemHeader, - RequestingModule, SuggestedModule)) { + + Optional<FileEntryRef> FE = getFileAndSuggestModule( + TmpDir, IncludeLoc, IncluderAndDir.second, IncluderIsSystemHeader, + RequestingModule, SuggestedModule); + + // If this is a system header, we should also search from the current + // working directory and not the directory of the module map. + if (!FE && IncluderIsSystemHeader) + FE = getFileAndSuggestModule( + Filename, IncludeLoc, IncluderAndDir.second, IncluderIsSystemHeader, + RequestingModule, SuggestedModule); + + if (FE) { if (!Includer) { assert(First && "only first includer can have no file"); return FE;
Index: clang/lib/Lex/HeaderSearch.cpp =================================================================== --- clang/lib/Lex/HeaderSearch.cpp +++ clang/lib/Lex/HeaderSearch.cpp @@ -819,9 +819,19 @@ bool IncluderIsSystemHeader = Includer ? getFileInfo(Includer).DirInfo != SrcMgr::C_User : BuildSystemModule; - if (Optional<FileEntryRef> FE = getFileAndSuggestModule( - TmpDir, IncludeLoc, IncluderAndDir.second, IncluderIsSystemHeader, - RequestingModule, SuggestedModule)) { + + Optional<FileEntryRef> FE = getFileAndSuggestModule( + TmpDir, IncludeLoc, IncluderAndDir.second, IncluderIsSystemHeader, + RequestingModule, SuggestedModule); + + // If this is a system header, we should also search from the current + // working directory and not the directory of the module map. + if (!FE && IncluderIsSystemHeader) + FE = getFileAndSuggestModule( + Filename, IncludeLoc, IncluderAndDir.second, IncluderIsSystemHeader, + RequestingModule, SuggestedModule); + + if (FE) { if (!Includer) { assert(First && "only first includer can have no file"); return FE;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits