From c7258a355060624ca1e2b1eb3a0bc5129971f6d0 Mon Sep 17 00:00:00 2001 From: Owen Voorhees Date: Thu, 18 Sep 2025 09:58:23 -0700 Subject: [PATCH] Fix ebm blocklist interactions with C++ interop --- .../Tools/SwiftCompiler.swift | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Sources/SWBCore/SpecImplementations/Tools/SwiftCompiler.swift b/Sources/SWBCore/SpecImplementations/Tools/SwiftCompiler.swift index 07215597..aeb86fc0 100644 --- a/Sources/SWBCore/SpecImplementations/Tools/SwiftCompiler.swift +++ b/Sources/SWBCore/SpecImplementations/Tools/SwiftCompiler.swift @@ -1407,25 +1407,21 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi let buildSettingEnabled = scope.evaluate(BuiltinMacros.SWIFT_ENABLE_EXPLICIT_MODULES) == .enabled || scope.evaluate(BuiltinMacros._EXPERIMENTAL_SWIFT_EXPLICIT_MODULES) == .enabled + // If this project is on the blocklist, override the blocklist default enable for it + if let explicitModuleBlocklist = await getExplicitModuleBlocklist(producer, scope, delegate), explicitModuleBlocklist.isProjectListed(scope) { + return false + } + // rdar://122829880 (Turn off Swift explicit modules when c++ interop is enabled) guard scope.evaluate(BuiltinMacros.SWIFT_OBJC_INTEROP_MODE) != "objcxx" && !scope.evaluate(BuiltinMacros.OTHER_SWIFT_FLAGS).contains("-cxx-interoperability-mode=default") else { - return scope.evaluate(BuiltinMacros._SWIFT_EXPLICIT_MODULES_ALLOW_CXX_INTEROP) + return scope.evaluate(BuiltinMacros._SWIFT_EXPLICIT_MODULES_ALLOW_CXX_INTEROP) && buildSettingEnabled } // Disable explicit modules in the pre-Swift-5 language modes to avoid versioned API notes confusion. guard let swiftVersion = try? Version(scope.evaluate(BuiltinMacros.SWIFT_VERSION)), swiftVersion >= Version(5) else { - return scope.evaluate(BuiltinMacros._SWIFT_EXPLICIT_MODULES_ALLOW_BEFORE_SWIFT_5) + return scope.evaluate(BuiltinMacros._SWIFT_EXPLICIT_MODULES_ALLOW_BEFORE_SWIFT_5) && buildSettingEnabled } - // If a blocklist is provided in the toolchain, use it to determine the default for the current project - guard let explicitModuleBlocklist = await getExplicitModuleBlocklist(producer, scope, delegate) else { - return buildSettingEnabled - } - - // If this project is on the blocklist, override the blocklist default enable for it - if explicitModuleBlocklist.isProjectListed(scope) { - return false - } return buildSettingEnabled }