diff options
| author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2018-07-18 23:21:19 +0000 |
|---|---|---|
| committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2018-07-18 23:21:19 +0000 |
| commit | 52431f39a3232b1d33ad62423ea67094181f684d (patch) | |
| tree | c2c29d56c85427e36a6aa9ff0a1a63a3a25fdeb7 /clang/lib/Serialization | |
| parent | a327a4c34e3c271c7d108000a65fa94ca0b5368d (diff) | |
| download | bcm5719-llvm-52431f39a3232b1d33ad62423ea67094181f684d.tar.gz bcm5719-llvm-52431f39a3232b1d33ad62423ea67094181f684d.zip | |
Reapply r336660: [Modules] 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: 337430
Diffstat (limited to 'clang/lib/Serialization')
| -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 19b5af38df2..4167e868809 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. |

