File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
test/Interop/Cxx/ergonomics Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 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)`.
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
Original file line number Diff line number Diff line change @@ -80,6 +80,10 @@ class SWIFT_CONFORMS_TO_PROTOCOL(SwiftMod.Proto) ConformsTo {
8080public:
8181} ;
8282
83+ class SWIFT_UNCHECKED_SENDABLE UnsafeSendable {
84+ public:
85+ } ;
86+
8387
8488// CHECK: struct SelfContained {
8589
@@ -101,3 +105,4 @@ public:
101105
102106// CHECK: struct ConformsTo : Proto {
103107
108+ // CHECK: struct UnsafeSendable : @unchecked Sendable {
You can’t perform that action at this time.
0 commit comments