Skip to content

Commit d004955

Browse files
committed
Check if the C++ compiler used to build the Concurrency library has the -fswift-async-fp flag
1 parent 3e4dd68 commit d004955

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

stdlib/public/Concurrency/CMakeLists.txt

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,29 @@ endif()
3535
set(SWIFT_RUNTIME_CONCURRENCY_C_FLAGS)
3636
set(SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS)
3737

38+
check_cxx_compiler_flag(-fswift-async-fp=always CXX_COMPILER_HAS_SWIFT_ASYNC_FP_FLAG)
39+
3840
if(NOT swift_concurrency_async_fp_mode)
3941
set(swift_concurrency_async_fp_mode "always")
4042
endif()
4143

42-
# Don't emit extended frame info on platforms other than darwin, system
43-
# backtracer and system debugger are unlikely to support it.
44+
# Don't emit extended frame info on platforms other than darwin, if the compiler
45+
# has that flag, as the system backtracer and system debugger are unlikely to
46+
# support it.
4447
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
45-
list(APPEND SWIFT_RUNTIME_CONCURRENCY_C_FLAGS
46-
"-fswift-async-fp=${swift_concurrency_async_fp_mode}")
47-
list(APPEND SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS
48-
"-Xfrontend"
49-
"-swift-async-frame-pointer=${swift_concurrency_async_fp_mode}")
50-
else()
48+
if(CXX_COMPILER_HAS_SWIFT_ASYNC_FP_FLAG)
49+
list(APPEND SWIFT_RUNTIME_CONCURRENCY_C_FLAGS
50+
"-fswift-async-fp=${swift_concurrency_async_fp_mode}")
51+
list(APPEND SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS
52+
"-Xfrontend"
53+
"-swift-async-frame-pointer=${swift_concurrency_async_fp_mode}")
54+
else()
55+
message(ERROR
56+
"The -fswift-async-fp clang flag is not available. This is most likely "
57+
"because you are using the Xcode toolchain, which may not have the "
58+
"latest flags yet.")
59+
endif()
60+
elseif(CXX_COMPILER_HAS_SWIFT_ASYNC_FP_FLAG)
5161
list(APPEND SWIFT_RUNTIME_CONCURRENCY_C_FLAGS "-fswift-async-fp=never")
5262
endif()
5363

0 commit comments

Comments
 (0)