Today, when you use NS_HEADER_AUDIT_BEGIN(nullability, sendability)
, closures are also assumed to be non-sendable. This is very optimistic, and kind of opposite to how escaping works. Obj-C closures are assumed to be escaping, and have to be opted in via __attribute__((noescape))
.
Looking more closely at the macro, it appears there's quite a bit of power here:
"clang attribute NS_HEADER_AUDIT_sendability.push (__attribute__((swift_attr(\"@_nonSendable(_assumed)\"))), apply_to = any(objc_interface, record, enum))"
Is it possible to construct a pragma that would import closures to be @Sendable such that they could then then be opted-out on a case-by-case basis using __attribute__((swift_attr("@_nonSendable")))
?