Skip to content

[cxx-interop] Handle different interop compat versions #1739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ extension DarwinToolchain {
// On Darwin, we only support libc++.
var cxxCompatEnabled = parsedOptions.hasArgument(.enableExperimentalCxxInterop)
if let cxxInteropMode = parsedOptions.getLastArgument(.cxxInteroperabilityMode) {
if cxxInteropMode.asSingle == "swift-5.9" {
if cxxInteropMode.asSingle != "off" {
cxxCompatEnabled = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ extension GenericUnixToolchain {
// just using `clang` and avoid a dependency on the C++ runtime.
var cxxCompatEnabled = parsedOptions.hasArgument(.enableExperimentalCxxInterop)
if let cxxInteropMode = parsedOptions.getLastArgument(.cxxInteroperabilityMode) {
if cxxInteropMode.asSingle == "swift-5.9" {
if cxxInteropMode.asSingle != "off" {
cxxCompatEnabled = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ extension WindowsToolchain {

var cxxCompatEnabled = parsedOptions.hasArgument(.enableExperimentalCxxInterop)
if let cxxInteropMode = parsedOptions.getLastArgument(.cxxInteroperabilityMode) {
if cxxInteropMode.asSingle == "swift-5.9" {
if cxxInteropMode.asSingle != "off" {
cxxCompatEnabled = true
}
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7064,7 +7064,7 @@ final class SwiftDriverTests: XCTestCase {
env["SWIFT_DRIVER_CLANGXX_EXEC"] = swiftClangxx.pathString

var driver = try Driver(
args: ["swiftc", "-cxx-interoperability-mode=swift-5.9", "-emit-library",
args: ["swiftc", "-cxx-interoperability-mode=swift-6", "-emit-library",
"foo.swift", "bar.o", "-o", "foo.l"],
env: env)

Expand Down Expand Up @@ -7707,7 +7707,7 @@ final class SwiftDriverTests: XCTestCase {
#else
VirtualPath.resetTemporaryFileStore()
var driver = try Driver(args: [
"swiftc", "-cxx-interoperability-mode=swift-5.9", "-emit-library", "-o", "library.dll", "library.obj"
"swiftc", "-cxx-interoperability-mode=upcoming-swift", "-emit-library", "-o", "library.dll", "library.obj"
])
let jobs = try driver.planBuild().removingAutolinkExtractJobs()
XCTAssertEqual(jobs.count, 1)
Expand Down