[ExplicitModuleBuild] Support -vfsoverlay swift option

Support `-vfsoverlay` swift option for explicit module build (including
caching build). Previously, if the interface file is discovered from a
location that is remapped by overlay, module cannot be built correctly.
Make sure the overlay options are passed down to all interface
compilaiton command.

For caching build, need to make sure the overlay itself is part of the CAS
file system so the downstream compilation can discover that.

rdar://123655183
This commit is contained in:
Steven Wu
2024-03-14 16:34:56 -07:00
parent 91dc6822fa
commit 471aea857a
4 changed files with 70 additions and 2 deletions

View File

@@ -1879,6 +1879,13 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
genericSubInvocation.getSearchPathOptions().ExplicitSwiftModuleMap =
explicitSwiftModuleMap.str();
// Pass down VFSOverlay flags (do not need to inherit the options because
// FileSystem is shared).
for (auto &Overlay : searchPathOpts.VFSOverlayFiles) {
GenericArgs.push_back("-vfsoverlay");
GenericArgs.push_back(Overlay);
}
// Load plugin libraries for macro expression as default arguments
genericSubInvocation.getSearchPathOptions().PluginSearchOpts =
searchPathOpts.PluginSearchOpts;