Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/swift/Frontend/ModuleInterfaceLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ class ExplicitCASModuleLoader : public SerializedModuleLoaderBase {
void collectVisibleTopLevelModuleNames(
SmallVectorImpl<Identifier> &names) const override;

void addExplicitModulePath(StringRef name, std::string path) override;

~ExplicitCASModuleLoader();
};

Expand Down
16 changes: 16 additions & 0 deletions lib/Frontend/ModuleInterfaceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down