mirror of
https://github.com/apple/swift.git
synced 2026-02-27 18:26:24 +01:00
[LLDB|CAS] Implement ExplicitCASModuleLoader::addExplicitModulePath()
This virtual function is called when parsing the control block of a Swift module to add the dependencies to the module loader's explicit Swift module map. For the compiler this has no practical effect since the explicit Swift module map should already cover all dependencies. LLDB doesn't have the explicit Swift module map and depends on this mechanism to discover dependencies. rdar://166494766
This commit is contained in:
@@ -2791,6 +2791,22 @@ void ExplicitCASModuleLoader::collectVisibleTopLevelModuleNames(
|
||||
}
|
||||
}
|
||||
|
||||
void ExplicitCASModuleLoader::addExplicitModulePath(StringRef name,
|
||||
std::string path) {
|
||||
// This is used by LLDB to discover the paths to dependencies of binary Swift
|
||||
// modules. Only do this if path exists in CAS, since there are use-cases
|
||||
// where a binary Swift module produced on a different machine is provided and
|
||||
// replacements for its dependencies are provided via the explicit module map.
|
||||
auto ID = Impl.CAS.parseID(path);
|
||||
if (!ID)
|
||||
return llvm::consumeError(ID.takeError());
|
||||
if (!Impl.CAS.getReference(*ID))
|
||||
return;
|
||||
|
||||
ExplicitSwiftModuleInputInfo entry(path, {}, {}, {});
|
||||
Impl.ExplicitModuleMap.try_emplace(name, std::move(entry));
|
||||
}
|
||||
|
||||
std::unique_ptr<ExplicitCASModuleLoader> ExplicitCASModuleLoader::create(
|
||||
ASTContext &ctx, llvm::cas::ObjectStore &CAS, llvm::cas::ActionCache &cache,
|
||||
DependencyTracker *tracker, ModuleLoadingMode loadMode,
|
||||
|
||||
Reference in New Issue
Block a user