[Explicit Module Builds] Only specify '-fmodule-map-file' for bridging header Clang module dependencies

Relying on the corresponding field in the '-explicit-swift-module-map-file' provided by the driver.

Only bridging headers require a module map because that's what aids header include resolution. With lazy module loading today, '.modulemap' parsing which happens when instantiating Clang is responsible for associating headers with modules. Then upon encountering a header include inside the bridging header the compiler knows which module corresponds to said header and is then able to load explicitly-provided PCM for that module. For all other module dependencies, they are only ever queried by-name from Swift, so '.modulemap' parsing is not necessary.
This commit is contained in:
Artem Chikin
2024-03-28 13:05:50 -07:00
parent 3947fa9e16
commit f3816e0335
7 changed files with 73 additions and 9 deletions

View File

@@ -1981,7 +1981,7 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts,
Args.hasArg(OPT_disable_modules_validate_system_headers);
if (const Arg *A = Args.getLastArg(OPT_explicit_swift_module_map))
Opts.ExplicitSwiftModuleMap = A->getValue();
Opts.ExplicitSwiftModuleMapPath = A->getValue();
for (auto A : Args.getAllArgValues(options::OPT_swift_module_file)) {
if (validateSwiftModuleFileArgumentAndAdd(A, Diags,
Opts.ExplicitSwiftModuleInputs))