This suppresses the implicit search for files called 'module.modulemap' and similar.
Details
Diff Detail
Event Timeline
I'm not sure this will do the right thing for framework modules; it looks like we'll infer a module map if you disable implicit module maps for them, which doesn't seem like the right behavior (see HeaderSearch::loadFrameworkModule).
There are a bunch of other functions in this file which do redundant work that we should short-circuit in this case:
- HeaderSearch::lookupModule should bail out after checking to see if we've already loaded the module, rather than looping over the include paths and doing nothing with them.
- HeaderSearch::hasModuleMap should just return immediately, rather than scanning upwards over all parent directories of a file and doing nothing with them.
- HeaderSearch::collectAllModules should skip its loop over all include paths.
- HeaderSearch::loadTopLevelSystemModules should skip its loop over all include paths.
- HeaderSearch::loadSubdirectoryModuleMaps should bail out or assert (it shouldn't be reachable if implicit module maps are disabled).
docs/Modules.rst | ||
---|---|---|
211 | In the documentation, we should refer to module.modulemap rather than the deprecated name module.map. | |
include/clang/Basic/LangOptions.def | ||
129 | module.modulemap | |
129 | This should be a COMPATIBLE_LANGOPT (or possibly a BENIGN_LANGOPT). | |
include/clang/Driver/Options.td | ||
678–680 | For driver options, we typically include both a -fblah and a -fno-blah (so the user can override earlier command-line options from $CXXFLAGS or similar). |
I think HeaderSearch::loadFrameworkModule() should not call ModuleMap::inferFrameworkModule() if implicit maps are deactivated. Inferred maps seems like a special case of implicit maps.
Also addressed all the other points.
docs/Modules.rst | ||
---|---|---|
211 | Changed. | |
include/clang/Basic/LangOptions.def | ||
129 | Made it a BENIGN_LANGOPT. | |
129 | Done. | |
include/clang/Driver/Options.td | ||
678–680 | Done. |
One comment to address, then please go ahead and commit.
lib/Frontend/CompilerInvocation.cpp | ||
---|---|---|
1467 | You're initializing this from itself if neither flag is set. Did you mean Opts.Modules or Opts.ModuleMaps, or maybe true? |
In the documentation, we should refer to module.modulemap rather than the deprecated name module.map.