[ScanDependency] Pass crossimport overlay file to swift-frontend

Teach dependency scanner to pass cross import overlay file to
swift-frontend for main module compilation. This allows swift-frontend
not to repeat the file system search for overlay files when loading
modules.

This also fixes the issue when caching is enabled, the cross import
doesn't work when the first module is a clang module because the module
built with caching using clang include tree does not preserve
DefinitionLoc which is used to inferred the modulemap location for cross
import overlay search.

rdar://127844120
This commit is contained in:
Steven Wu
2024-05-10 13:10:09 -07:00
parent 35cda47779
commit cf8187a4fe
9 changed files with 118 additions and 25 deletions

View File

@@ -2068,6 +2068,12 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts, ArgList &Args,
*forceModuleLoadingMode);
}
for (auto *A : Args.filtered(OPT_swift_module_cross_import))
Opts.CrossImportInfo[A->getValue(0)].push_back(A->getValue(1));
Opts.DisableCrossImportOverlaySearch |=
Args.hasArg(OPT_disable_cross_import_overlay_search);
// Opts.RuntimeIncludePath is set by calls to
// setRuntimeIncludePath() or setMainExecutablePath().
// Opts.RuntimeImportPath is set by calls to