Skip to content

Commit f4d3ee6

Browse files
[embedded] Use __has_extension(swiftcc) to detect Swift calling convention
This change replaces the use of `__has_feature(swiftasynccc)` with `__has_extension(swiftcc)` to detect the SwiftCC availability. The former condition works fine for most platforms that support both SwiftCC and SwiftAsyncCC or neither, but it fails for WebAssembly, which supports SwiftCC but not SwiftAsyncCC. We add `swiftcc` extension to Clang, and use it here.
1 parent f3441c0 commit f4d3ee6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

stdlib/public/SwiftShims/swift/shims/EmbeddedShims.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
extern "C" {
2929
#endif
3030

31-
// FIXME: Replace with __has_feature(swiftcc) once that's added to Clang.
32-
#if __has_feature(swiftasynccc)
31+
// TODO: __has_feature(swiftasynccc) is just for older clang. Remove this
32+
// when we no longer support older clang.
33+
#if __has_extension(swiftcc) || __has_feature(swiftasynccc)
3334
#define SWIFT_CC_swift __attribute__((swiftcall))
3435
#define SWIFT_CONTEXT __attribute__((swift_context))
3536
#define SWIFT_ERROR_RESULT __attribute__((swift_error_result))

0 commit comments

Comments
 (0)