[Serialization] Store the explicit module map in swiftmodules

Currently only the top level dependencies get serialized in Swift modules. In
practice this is not enough information to fully replay a module import
sequence, especially when the dependencies include binary SDK modules that were
built elsewhere. In this case we cannot follow the links to its depenencies,
since they refer to paths on a different machine or unavailable CAS. During an
EBM build, the dependency scanner writes the complete list of dependencies into
a json file called the explicit Swift module map -- including the local
locations of the dependencies of binary SDK modules. Using this LLDB can replay
a module import with 100% accuracy.

rdar://170514919
This commit is contained in:
Adrian Prantl
2026-02-23 11:30:43 -08:00
parent a298d72fdf
commit fa71d1da59
18 changed files with 709 additions and 400 deletions
-5
View File
@@ -214,11 +214,6 @@ ModuleFile::loadDependenciesForFileContext(const FileUnit *file,
auto importPath = builder.copyTo(ctx);
auto modulePath = importPath.getModulePath(dependency.isScoped());
auto accessPath = importPath.getAccessPath(dependency.isScoped());
if (!getContext().LangOpts.DisableDeserializationOfExplicitPaths &&
!dependency.Core.BinaryModulePath.empty())
ctx.addExplicitModulePath(modulePath.front().Item.str(),
dependency.Core.BinaryModulePath.str());
auto module = getModule(modulePath, /*allowLoading*/true);
if (!module || module->failedToLoad()) {
// If we're missing the module we're an overlay for, treat that specially.