Skip to content

Commit b3a3859

Browse files
authored
Merge pull request #837 from egorzhdan/egorzhdan/cxx-2b-flag
Pass `-Xcc -std=c++2b` to Swift when `CLANG_CXX_LANGUAGE_STANDARD` is set to `c++2b`
2 parents ac53071 + 9287256 commit b3a3859

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Sources/SWBUniversalPlatform/Specs/Swift.xcspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,8 @@
14201420
"objcxx-gnu++20" = ("-Xcc", "-std=$(CLANG_CXX_LANGUAGE_STANDARD)");
14211421
"objcxx-c++23" = ("-Xcc", "-std=$(CLANG_CXX_LANGUAGE_STANDARD)");
14221422
"objcxx-gnu++23" = ("-Xcc", "-std=$(CLANG_CXX_LANGUAGE_STANDARD)");
1423+
"objcxx-c++2b" = ("-Xcc", "-std=$(CLANG_CXX_LANGUAGE_STANDARD)");
1424+
"objcxx-gnu++2b" = ("-Xcc", "-std=$(CLANG_CXX_LANGUAGE_STANDARD)");
14231425
"<<otherwise>>" = ();
14241426
};
14251427
},

Tests/SWBTaskConstructionTests/SwiftTaskConstructionTests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4052,6 +4052,15 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests {
40524052
}
40534053
}
40544054

4055+
try await withTemporaryDirectory { tmpDir in
4056+
let tester = try await setupInteropTest(tmpDir, enableInterop: true, cxxLangStandard: "c++2b")
4057+
await tester.checkBuild(runDestination: .macOS) { results in
4058+
results.checkTask(.matchRuleType("SwiftDriver Compilation")) { task in
4059+
task.checkCommandLineContainsUninterrupted(["-Xcc", "-std=c++2b"])
4060+
}
4061+
}
4062+
}
4063+
40554064
// Verify that we don't pass C++ settings to Swift compilations when C++
40564065
// interoperability is disabled.
40574066
try await withTemporaryDirectory { tmpDir in

0 commit comments

Comments
 (0)