@@ -35,19 +35,29 @@ endif()
35
35
set (SWIFT_RUNTIME_CONCURRENCY_C_FLAGS )
36
36
set (SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS )
37
37
38
+ check_cxx_compiler_flag (-fswift-async-fp=always CXX_COMPILER_HAS_SWIFT_ASYNC_FP_FLAG )
39
+
38
40
if (NOT swift_concurrency_async_fp_mode )
39
41
set (swift_concurrency_async_fp_mode "always" )
40
42
endif ()
41
43
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.
44
47
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 )
51
61
list (APPEND SWIFT_RUNTIME_CONCURRENCY_C_FLAGS "-fswift-async-fp=never" )
52
62
endif ()
53
63
0 commit comments