mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Allow imported types to add a Sendable conformance
...by using `__attribute__((swift_attr("@Sendable")))`. `@_nonSendable` will "beat" `@Sendable`, while `@_nonSendable(_assumed)` will not.
This commit also checks if `SwiftAttr` supports `#pragma clang attribute` and, if it does, defines `__SWIFT_ATTR_SUPPORTS_SENDABLE_DECLS` in imported headers so they know they can apply these attributes in an auditing style.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
|
||||
// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -print-interface -source-filename %s -module-to-print=ObjCConcurrency -function-definitions=false | %FileCheck %s
|
||||
// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -print-interface -source-filename %s -module-to-print=ObjCConcurrency -function-definitions=false > %t/ObjCConcurrency.printed.txt
|
||||
// RUN: %FileCheck -input-file %t/ObjCConcurrency.printed.txt %s
|
||||
// RUN: %FileCheck -check-prefix NEGATIVE -input-file %t/ObjCConcurrency.printed.txt %s
|
||||
|
||||
|
||||
// REQUIRES: objc_interop
|
||||
// REQUIRES: concurrency
|
||||
@@ -12,3 +15,18 @@ import _Concurrency
|
||||
// CHECK-NOT: @available
|
||||
// CHECK: func doSomethingSlow(_ operation: String, completionHandler handler: @escaping (Int) -> Void)
|
||||
// CHECK: func doSomethingSlow(_ operation: String) async -> Int
|
||||
|
||||
// NEGATIVE-NOT: @Sendable{{.+}}class
|
||||
// NEGATIVE-NOT: @_nonSendable{{.+}}class
|
||||
|
||||
// CHECK-LABEL: class SendableClass :
|
||||
// CHECK-SAME: @unchecked Sendable
|
||||
|
||||
// CHECK-LABEL: class NonSendableClass
|
||||
|
||||
// CHECK-LABEL: class AuditedSendable :
|
||||
// CHECK-SAME: @unchecked Sendable
|
||||
|
||||
// CHECK-LABEL: class AuditedNonSendable
|
||||
|
||||
// CHECK-LABEL: class AuditedBoth
|
||||
|
||||
Reference in New Issue
Block a user