mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Explicit Module Builds] Propagate the C++ Interop mode to interface sub-invocations and dependency scanner
This commit is contained in:
@@ -1971,6 +1971,31 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
|
||||
GenericArgs.push_back("-blocklist-file");
|
||||
GenericArgs.push_back(blocklist);
|
||||
}
|
||||
|
||||
// For now, we only inherit the C++ interoperability mode in
|
||||
// Explicit Module Builds.
|
||||
if (langOpts.EnableCXXInterop &&
|
||||
(frontendOpts.DisableImplicitModules ||
|
||||
LoaderOpts.requestedAction ==
|
||||
FrontendOptions::ActionType::ScanDependencies)) {
|
||||
// Modelled after a reverse of validateCxxInteropCompatibilityMode
|
||||
genericSubInvocation.getLangOptions().EnableCXXInterop = true;
|
||||
genericSubInvocation.getLangOptions().cxxInteropCompatVersion =
|
||||
langOpts.cxxInteropCompatVersion;
|
||||
std::string compatVersion;
|
||||
if (langOpts.cxxInteropCompatVersion.empty())
|
||||
compatVersion = "default";
|
||||
else if (langOpts.cxxInteropCompatVersion[0] == 5)
|
||||
compatVersion = "swift-5.9";
|
||||
else if (langOpts.cxxInteropCompatVersion[0] ==
|
||||
version::getUpcomingCxxInteropCompatVersion())
|
||||
compatVersion = "upcoming-swift";
|
||||
else // TODO: This may need to be updated once more versions are added
|
||||
compatVersion = "default";
|
||||
|
||||
GenericArgs.push_back(
|
||||
ArgSaver.save("-cxx-interoperability-mode=" + compatVersion));
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculate an output filename in \p genericSubInvocation's cache path that
|
||||
|
||||
Reference in New Issue
Block a user