Skip to content

Commit d9f0f8e

Browse files
Merge pull request #73082 from adrian-prantl/experimental-cxx-6.0
Prefix experimental interop flag with -Xfrontend
2 parents f7ea907 + 659cb52 commit d9f0f8e

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

SwiftCompilerSources/CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,6 @@ function(add_swift_compiler_modules_library name)
9898
"DEPENDS"
9999
${ARGN})
100100

101-
# Prior to 5.9, we have to use the experimental flag for C++ interop.
102-
if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.9)
103-
set(cxx_interop_flag "-enable-experimental-cxx-interop")
104-
else()
105-
set(cxx_interop_flag "-cxx-interoperability-mode=default")
106-
endif()
107-
108101
set(swift_compile_options
109102
"-color-diagnostics"
110103
"-Xfrontend" "-validate-tbd-against-ir=none"
@@ -113,6 +106,12 @@ function(add_swift_compiler_modules_library name)
113106
"-Xcc" "-std=c++17"
114107
"-Xcc" "-DCOMPILED_WITH_SWIFT" "-Xcc" "-DSWIFT_TARGET"
115108
"-Xcc" "-UIBOutlet" "-Xcc" "-UIBAction" "-Xcc" "-UIBInspectable")
109+
# Prior to 5.9, we have to use the experimental flag for C++ interop.
110+
if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.9)
111+
list(APPEND swift_compile_options "-Xfrontend" "-enable-experimental-cxx-interop")
112+
else()
113+
list(APPEND swift_compile_options "-cxx-interoperability-mode=default")
114+
endif()
116115

117116
if (NOT BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS")
118117
if(SWIFT_MIN_RUNTIME_VERSION)

lib/ASTGen/CMakeLists.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,9 @@ foreach(c_include_path ${c_include_paths})
9494
list(APPEND c_include_paths_args "SHELL: -Xcc -I -Xcc ${c_include_path}")
9595
endforeach()
9696

97-
# Prior to 5.9, we have to use the experimental flag for C++ interop.
98-
if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.9)
99-
set(cxx_interop_flag "-enable-experimental-cxx-interop")
100-
else()
101-
set(cxx_interop_flag "-cxx-interoperability-mode=default")
102-
endif()
103-
10497
set(compile_options
10598
${c_include_paths_args}
10699
"SHELL: -DRESILIENT_SWIFT_SYNTAX"
107-
"SHELL: ${cxx_interop_flag}"
108100
"SHELL: -Xcc -std=c++17 -Xcc -DCOMPILED_WITH_SWIFT"
109101

110102
# FIXME: Needed to work around an availability issue with CxxStdlib
@@ -116,6 +108,13 @@ set(compile_options
116108
"SHELL:-Xcc -D_CRT_USE_BUILTIN_OFFSETOF"
117109
)
118110

111+
# Prior to 5.9, we have to use the experimental flag for C++ interop.
112+
if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.9)
113+
list(APPEND compile_options "-Xfrontend" "-enable-experimental-cxx-interop")
114+
else()
115+
list(APPEND compile_options "-cxx-interoperability-mode=default")
116+
endif()
117+
119118
if(SWIFT_BUILD_SWIFT_SYNTAX)
120119
foreach(target swiftASTGen swiftLLVMJSON swiftIDEUtilsBridging)
121120
target_compile_options(${target} PRIVATE ${compile_options})

0 commit comments

Comments
 (0)