mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add -swift-module-file frontend flag for explicit Swift module dependencies
This commit is contained in:
@@ -1897,6 +1897,16 @@ struct ExplicitSwiftModuleLoader::Implementation {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void addCommandLineExplicitInputs(
|
||||
const std::vector<std::pair<std::string, std::string>>
|
||||
&commandLineExplicitInputs) {
|
||||
for (const auto &moduleInput : commandLineExplicitInputs) {
|
||||
ExplicitModuleInfo entry;
|
||||
entry.modulePath = moduleInput.second;
|
||||
ExplicitModuleMap.try_emplace(moduleInput.first, std::move(entry));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ExplicitSwiftModuleLoader::ExplicitSwiftModuleLoader(
|
||||
@@ -2057,6 +2067,7 @@ std::unique_ptr<ExplicitSwiftModuleLoader>
|
||||
ExplicitSwiftModuleLoader::create(ASTContext &ctx,
|
||||
DependencyTracker *tracker, ModuleLoadingMode loadMode,
|
||||
StringRef ExplicitSwiftModuleMap,
|
||||
const std::vector<std::pair<std::string, std::string>> &ExplicitSwiftModuleInputs,
|
||||
bool IgnoreSwiftSourceInfoFile) {
|
||||
auto result = std::unique_ptr<ExplicitSwiftModuleLoader>(
|
||||
new ExplicitSwiftModuleLoader(ctx, tracker, loadMode,
|
||||
@@ -2067,6 +2078,11 @@ ExplicitSwiftModuleLoader::create(ASTContext &ctx,
|
||||
// Parse a JSON file to collect explicitly built modules.
|
||||
Impl.parseSwiftExplicitModuleMap(ExplicitSwiftModuleMap);
|
||||
}
|
||||
// If some modules are provided with explicit
|
||||
// '-swift-module-file' options, add those as well.
|
||||
if (!ExplicitSwiftModuleInputs.empty()) {
|
||||
Impl.addCommandLineExplicitInputs(ExplicitSwiftModuleInputs);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user