diff options
author | Yuka Takahashi <yukatkh@gmail.com> | 2018-07-10 12:17:34 +0000 |
---|---|---|
committer | Yuka Takahashi <yukatkh@gmail.com> | 2018-07-10 12:17:34 +0000 |
commit | a15364152cf4d6267a82b616151de301291f2f5b (patch) | |
tree | 9f0199ce6c9e8187c067e8d5cf45285dde7754f1 /clang/lib/Serialization/ASTReader.cpp | |
parent | 1ffeb5d7f0a96df2e06b10252092dca3bbe610aa (diff) | |
download | bcm5719-llvm-a15364152cf4d6267a82b616151de301291f2f5b.tar.gz bcm5719-llvm-a15364152cf4d6267a82b616151de301291f2f5b.zip |
[modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts
Summary:
Reproducer and errors:
https://bugs.llvm.org/show_bug.cgi?id=37878
lookupModule was falling back to loadSubdirectoryModuleMaps when it couldn't
find ModuleName in (proper) search paths. This was causing iteration over all
files in the search path subdirectories for example "/usr/include/foobar" in
bugzilla case.
Users don't expect Clang to load modulemaps in subdirectories implicitly, and
also the disk access is not cheap.
if (AllowExtraModuleMapSearch) true with ObjC with @import ModuleName.
Reviewers: rsmith, aprantl, bruno
Subscribers: cfe-commits, teemperor, v.g.vassilev
Differential Revision: https://reviews.llvm.org/D48367
llvm-svn: 336660
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 32772436678..78ca5f7406c 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -2626,7 +2626,9 @@ ASTReader::ReadControlBlock(ModuleFile &F, "MODULE_DIRECTORY found before MODULE_NAME"); // If we've already loaded a module map file covering this module, we may // have a better path for it (relative to the current build). - Module *M = PP.getHeaderSearchInfo().lookupModule(F.ModuleName); + Module *M = PP.getHeaderSearchInfo().lookupModule( + F.ModuleName, /*AllowSearch*/ true, + /*AllowExtraModuleMapSearch*/ true); if (M && M->Directory) { // If we're implicitly loading a module, the base directory can't // change between the build and use. |