@@ -2014,12 +2014,8 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
20142014 GenericArgs.push_back (blocklist);
20152015 }
20162016
2017- // For now, we only inherit the C++ interoperability mode in
2018- // Explicit Module Builds.
2019- if (langOpts.EnableCXXInterop &&
2020- (frontendOpts.DisableImplicitModules ||
2021- LoaderOpts.requestedAction ==
2022- FrontendOptions::ActionType::ScanDependencies)) {
2017+ // Inherit the C++ interoperability mode.
2018+ if (langOpts.EnableCXXInterop ) {
20232019 // Modelled after a reverse of validateCxxInteropCompatibilityMode
20242020 genericSubInvocation.getLangOptions ().EnableCXXInterop = true ;
20252021 genericSubInvocation.getLangOptions ().cxxInteropCompatVersion =
@@ -2208,6 +2204,19 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
22082204 BuildArgs.push_back (" -module-name" );
22092205 BuildArgs.push_back (moduleName);
22102206
2207+ // FIXME: Hack for Darwin.swiftmodule, which cannot be rebuilt with C++
2208+ // interop enabled by the Swift CI because it uses an old host SDK.
2209+ if (moduleName == " Darwin" ) {
2210+ subInvocation.getLangOptions ().EnableCXXInterop = false ;
2211+ subInvocation.getLangOptions ().cxxInteropCompatVersion = {};
2212+ BuildArgs.erase (llvm::remove_if (BuildArgs,
2213+ [](StringRef arg) -> bool {
2214+ return arg.starts_with (
2215+ " -cxx-interoperability-mode=" );
2216+ }),
2217+ BuildArgs.end ());
2218+ }
2219+
22112220 // Calculate output path of the module.
22122221 llvm::SmallString<256 > buffer;
22132222 StringRef CacheHash;
0 commit comments