Skip to content

Commit f1ca417

Browse files
committed
[cxx-interop] Run benchmarks in C++20 mode
This will allow benchmarking Swift access to `std::span` which is a C++20 feature and therefore requires compiling with `-Xcc -std=c++20`.
1 parent c21a3a9 commit f1ca417

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

benchmark/Package.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.0
1+
// swift-tools-version:5.4
22

33
import PackageDescription
44
import Foundation
@@ -191,5 +191,6 @@ let p = Package(
191191
name: "swiftbench",
192192
products: products,
193193
targets: targets,
194-
swiftLanguageVersions: [.v4]
194+
swiftLanguageVersions: [.v4],
195+
cxxLanguageStandard: .cxx20
195196
)

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ function (swift_benchmark_compile_archopts)
485485
set(cxx_options "")
486486
if ("${module_name_path}" MATCHES ".*cxx-source/.*")
487487
list(APPEND cxx_options "-Xfrontend" "-enable-experimental-cxx-interop" "-I" "${srcdir}/utils/CxxTests/")
488+
list(APPEND cxx_options "-Xcc" "-std=c++20")
488489
# FIXME: https://github.com/apple/swift/issues/61453
489490
list(APPEND cxx_options "-Xfrontend" "-validate-tbd-against-ir=none")
490491
endif()
@@ -596,6 +597,7 @@ function (swift_benchmark_compile_archopts)
596597
"-emit-module" "-module-name" "${module_name}"
597598
"-I" "${objdir}"
598599
"-Xfrontend" "-enable-experimental-cxx-interop"
600+
"-Xcc" "-std=c++20"
599601
"-I" "${srcdir}/utils/CxxTests/"
600602
"-o" "${objdir}/${module_name}.o"
601603
"${source}")

0 commit comments

Comments
 (0)