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 | f40124d4f05ecf4f880cf4e8f26922d861f705f3 (patch) | |
tree | b86ec42bd9f950e354bc7561951dd7a10ecb5ad9 /include/clang/Lex | |
parent | 6d65cdc2f9f94c17c9118e5a77f340323013ffbe (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex')
-rw-r--r-- | include/clang/Lex/HeaderSearch.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h index fd52000954..b7147c54fa 100644 --- a/include/clang/Lex/HeaderSearch.h +++ b/include/clang/Lex/HeaderSearch.h @@ -529,8 +529,12 @@ public: /// search directories to produce a module definition. If not, this lookup /// will only return an already-known module. /// + /// \param AllowExtraModuleMapSearch Whether we allow to search modulemaps + /// in subdirectories. + /// /// \returns The module with the given name. - Module *lookupModule(StringRef ModuleName, bool AllowSearch = true); + Module *lookupModule(StringRef ModuleName, bool AllowSearch = true, + bool AllowExtraModuleMapSearch = false); /// Try to find a module map file in the given directory, returning /// \c nullptr if none is found. @@ -595,8 +599,12 @@ private: /// but for compatibility with some buggy frameworks, additional attempts /// may be made to find the module under a related-but-different search-name. /// + /// \param AllowExtraModuleMapSearch Whether we allow to search modulemaps + /// in subdirectories. + /// /// \returns The module named ModuleName. - Module *lookupModule(StringRef ModuleName, StringRef SearchName); + Module *lookupModule(StringRef ModuleName, StringRef SearchName, + bool AllowExtraModuleMapSearch = false); /// Retrieve a module with the given name, which may be part of the /// given framework. |