Skip to content

Commit 38b3d81

Browse files
committed
ModuleInterface: pass-down explicit Swift module paths when building module from interface
1 parent 28b0b22 commit 38b3d81

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

include/swift/Frontend/ModuleInterfaceLoader.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,12 @@ struct ModuleInterfaceLoaderOptions {
131131
bool remarkOnRebuildFromInterface = false;
132132
bool disableInterfaceLock = false;
133133
bool disableImplicitSwiftModule = false;
134+
std::vector<std::string> explicitSwiftModules;
134135
ModuleInterfaceLoaderOptions(const FrontendOptions &Opts):
135136
remarkOnRebuildFromInterface(Opts.RemarkOnRebuildFromModuleInterface),
136137
disableInterfaceLock(Opts.DisableInterfaceFileLock),
137-
disableImplicitSwiftModule(Opts.DisableImplicitModules) {}
138+
disableImplicitSwiftModule(Opts.DisableImplicitModules),
139+
explicitSwiftModules(Opts.ExplicitSwiftModules) {}
138140
ModuleInterfaceLoaderOptions() = default;
139141
};
140142
/// A ModuleLoader that runs a subordinate \c CompilerInvocation and

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,14 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
12011201
subInvocation.getFrontendOptions().DisableImplicitModules = true;
12021202
GenericArgs.push_back("-disable-implicit-swift-modules");
12031203
}
1204+
subInvocation.getFrontendOptions().ExplicitSwiftModules =
1205+
LoaderOpts.explicitSwiftModules;
1206+
// Dependencies scanner shouldn't know any explict Swift modules to use.
1207+
// Adding these argumnets may not be necessary.
1208+
// FIXME: remove it?
1209+
for (auto EM: LoaderOpts.explicitSwiftModules) {
1210+
GenericArgs.push_back(ArgSaver.save((llvm::Twine("-swift-module-file=") + EM).str()));
1211+
}
12041212
if (clangImporter) {
12051213
// We need to add these extra clang flags because explict module building
12061214
// related flags are all there: -fno-implicit-modules, -fmodule-map-file=,

0 commit comments

Comments
 (0)