Skip to content

Commit 49ea89d

Browse files
authored
Merge pull request #1 from Genaro-Chris/Genaro-Chris-patch-1
Update bridging
2 parents a8d43c7 + 190f050 commit 49ea89d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/ClangImporter/bridging

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,19 @@
140140
#define SWIFT_MUTATING \
141141
__attribute__((swift_attr("mutating")))
142142

143+
/// Specifies that a specific c++ type such class or struct should be imported as type marked
144+
/// as `@unchecked Sendable` type in swift. If this annotation is used, the type is therefore allowed to
145+
/// use safely across async contexts.
146+
///
147+
/// For example
148+
/// ```
149+
/// class SWIFT_UNCHECKED_SENDABLE CustomUserType
150+
/// { ... }
151+
/// ```
152+
/// Will be imported as `struct CustomUserType: @unchecked Sendable`
153+
#define SWIFT_UNCHECKED_SENDABLE \
154+
__attribute__((swift_attr("@Sendable)))
155+
143156
#else // #if _CXX_INTEROP_HAS_ATTRIBUTE(swift_attr)
144157
145158
// Empty defines for compilers that don't support `attribute(swift_attr)`.
@@ -151,7 +164,8 @@
151164
#define SWIFT_NAME(_name)
152165
#define SWIFT_CONFORMS_TO_PROTOCOL(_moduleName_protocolName)
153166
#define SWIFT_COMPUTED_PROPERTY
154-
#define SWIFT_MUTATING
167+
#define SWIFT_MUTATING
168+
#define SWIFT_UNCHECKED_SENDABLE
155169
156170
#endif // #if _CXX_INTEROP_HAS_ATTRIBUTE(swift_attr)
157171

0 commit comments

Comments
 (0)