Commit Graph

11 Commits

Author SHA1 Message Date
Allan Shortlidge
58bf087a0e PrintAsClang: Add support for availability attrs with custom domains.
Resolves rdar://154510571.
2025-07-23 21:53:05 -07:00
Alexis Laferrière
bd110a073d PrintAsClang: Forward reference enums when used transitively
There are two main scenarios when printing a compatibility header that
references a @cdecl enum defined in Swift code. (1) When defined in the
same module as it's used we can print the definition normally and then
reference it. (2) When used in a different mode we need to print a
forward declaration before we can reference it.

This change adds printing the forward declaration and fix an issue where
the compiler would instead print an @include of the Swift module. The
import of the Swift module would work only in a local scenario where a
compatibility header and module would be generated under the same name.
However for a distributed frameworks we do not distribute the
compatibility header so this strategy doesn't work. Relying on a forward
declaration should be more reliable in all cases but clients may need to
import the other compatibility header explicitly.
2025-06-09 11:54:13 -07:00
Alexis Laferrière
138e2daa3e PrintAsClang: Print @cdecl enums in the compatibility header
Print @cdecl enums in the C section of the compatibility header. Use and
extend the macros to support C compiler clients.

The macro is adapted to the features supported by the client compiler.
It uses an Objective-C style macro with raw type when available and
fallbacks to a simple typedef for C compatibility.
2025-06-09 11:54:13 -07:00
Egor Zhdan
fcb590690e [cxx-interop] Support char8_t C++20 type
https://en.cppreference.com/w/cpp/keyword/char8_t

This is based on a patch from Varun Gandhi: https://github.com/swiftlang/swift/pull/26153

rdar://39988329 / resolves https://github.com/swiftlang/swift/issues/68726
2024-09-27 13:56:03 +01:00
QuietMisdreavus
8981535283 add missing symbols to compatibility-symbols (#64510)
rdar://104389344
2023-04-03 11:50:33 -06:00
QuietMisdreavus
59b3f111a5 fix typo in SWIFT_DEPRECATED_OBJC
rdar://106046585
2023-02-28 14:25:35 -07:00
swift-ci
d7c31aa241 Merge pull request #63902 from apple/QuietMisdreavus/enum-macro
fix bad expansion of SWIFT_ENUM
2023-02-25 10:16:24 -08:00
QuietMisdreavus
41576c5c10 fix bad expansion of SWIFT_ENUM
fixes 63837
2023-02-24 16:30:31 -07:00
Alex Lorenz
3948a2a5d3 [interop][SwiftToCxx] annotate inline thunks with SWIFT_INLINE_THUNK
This macro applies always_inline in addition to inline. It also applies artificial, which lets debugger know that this is an artificial function. The used attribute is added in debug builds to ensure that the symbol is emitted in the binary so that LLDB can invoke it.
2023-02-24 11:23:46 -08:00
Becca Royal-Gordon
00aa845bd3 [NFC] Fix change in SWIFT_CLASS_NAMED macro
apple/swift#59072 accidentally changed the SWIFT_CLASS_NAMED macro to use `__attribute` when it previously used `__attribute__` (note the trailing underscores). While both keywords have the same semantics in clang, they are technically different tokens, so clang refuses to merge macro definitions that use one instead of the other; instead it would diagnose an ambiguity when a generated header from a new compiler imported a generated header from an old compiler. Change back to the old token to avoid this problem.

Fixes rdar://104252758.
2023-01-31 16:16:16 -08:00
QuietMisdreavus
8d548efbb9 install a list of symbols generated by the PrintAsClang header (#59072)
rdar://93504690
2022-12-09 16:38:02 -07:00