Skip to content

Commit f70cfae

Browse files
committed
[clang] Restore has_feature(swiftasynccc) while swift moves to has_extension.
ea1fea6 added has_extension(swiftcc), but also turned swiftasynccc from a feature to an extension. This breaks swift versions that predate the transition (swiftlang/swift@1f91d9547fa). Restore a temporary swiftasynccc feature to keep supporting older versions. rdar://133628186
1 parent 4d5ee57 commit f70cfae

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

clang/include/clang/Basic/Features.def

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ EXTENSION(swiftcc,
126126
EXTENSION(swiftasynccc,
127127
PP.getTargetInfo().checkCallingConvention(CC_SwiftAsync) ==
128128
clang::TargetInfo::CCCR_OK)
129+
130+
// We have the extension above. Keep the feature for older swift stdlib,
131+
// since it only learned to check the extensions recently.
132+
// rdar://133628186
133+
FEATURE(swiftasynccc,
134+
PP.getTargetInfo().checkCallingConvention(CC_SwiftAsync) ==
135+
clang::TargetInfo::CCCR_OK)
136+
129137
FEATURE(pragma_stdc_cx_limited_range, true)
130138
// Objective-C features
131139
FEATURE(objc_arr, LangOpts.ObjCAutoRefCount) // FIXME: REMOVE?

clang/test/Sema/swift-call-conv.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,12 @@ void __attribute__((__swiftcall__)) f(void) {}
1717
// expected-warning@+2 {{'__swiftasynccall__' calling convention is not supported for this target}}
1818
#endif
1919
void __attribute__((__swiftasynccall__)) g(void) {}
20+
21+
// Allow has_feature in addition to has_extension to let swift transition.
22+
// rdar://133628186
23+
#if __has_feature(swiftasynccc)
24+
// expected-no-diagnostics
25+
#else
26+
// expected-warning@+2 {{'__swiftasynccall__' calling convention is not supported for this target}}
27+
#endif
28+
void __attribute__((__swiftasynccall__)) h(void) {}

0 commit comments

Comments
 (0)