Parser: Accept @cdecl with an indentifier for the C name

Begin accepting the attribute in the form of `@cdecl(cName)`, using an
identifier instead of a string.

For ease of landing this change we still accept the string form. We
should stop accepting it before making this feature available in
production.
This commit is contained in:
Alexis Laferrière
2025-05-16 15:33:20 -07:00
parent b8b13d8086
commit 2601ff44d4
4 changed files with 61 additions and 4 deletions

View File

@@ -28,8 +28,8 @@
// CHECK: #endif
/// My documentation
@cdecl("simple")
func a_simple(x: Int, bar y: Int) -> Int { return x }
@cdecl(simple)
func a0_simple(x: Int, bar y: Int) -> Int { return x }
// CHECK-LABEL: // My documentation
// CHECK-LABEL: SWIFT_EXTERN ptrdiff_t simple(ptrdiff_t x, ptrdiff_t y) SWIFT_NOEXCEPT SWIFT_WARN_UNUSED_RESULT;