Reapply r336660: [Modules] Autoload subdirectory modulemaps with specific…

Authored by bruno on Jul 18 2018, 4:21 PM.


Reapply r336660: [Modules] Autoload subdirectory modulemaps with specific LangOpts

Reproducer and errors:

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