|
1 | 1 | // RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name attrs \ |
| 2 | +// RUN: -emit-private-module-interface-path %t.private.swiftinterface \ |
2 | 3 | // RUN: -enable-experimental-feature ABIAttribute \ |
3 | 4 | // RUN: -enable-experimental-feature ExecutionAttribute |
4 | 5 |
|
5 | 6 | // RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name attrs |
| 7 | +// RUN: %target-swift-typecheck-module-from-interface(%t.private.swiftinterface) -module-name attrs |
6 | 8 |
|
7 | | -// RUN: %FileCheck %s --input-file %t.swiftinterface |
| 9 | +// RUN: %FileCheck %s --check-prefixes CHECK,PUBLIC-CHECK --input-file %t.swiftinterface |
| 10 | +// RUN: %FileCheck %s --check-prefixes CHECK,PRIVATE-CHECK --input-file %t.private.swiftinterface |
8 | 11 |
|
9 | 12 | // REQUIRES: swift_feature_ABIAttribute |
10 | 13 | // REQUIRES: swift_feature_ExecutionAttribute |
@@ -35,26 +38,55 @@ internal func __specialize_someGenericFunction<T>(_ t: T) -> Int { |
35 | 38 | fatalError("don't call") |
36 | 39 | } |
37 | 40 |
|
38 | | -@abi(public func __abi__abiAttrOnFunction(param: Int)) |
| 41 | +@abi(func __abi__abiAttrOnFunction(param: Int)) |
39 | 42 | public func abiAttrOnFunction(param: Int) {} |
40 | 43 | // CHECK: #if {{.*}} $ABIAttribute |
41 | | -// CHECK: @abi(public func __abi__abiAttrOnFunction(param: Swift.Int)) |
| 44 | +// CHECK: @abi(func __abi__abiAttrOnFunction(param: Swift.Int)) |
42 | 45 | // CHECK: public func abiAttrOnFunction(param: Swift.Int) |
43 | 46 | // CHECK: #else |
44 | 47 | // CHECK: @_silgen_name("$s5attrs07__abi__B14AttrOnFunction5paramySi_tF") |
45 | 48 | // CHECK: public func abiAttrOnFunction(param: Swift.Int) |
46 | 49 | // CHECK: #endif |
47 | 50 |
|
48 | | -@abi(public let __abi__abiAttrOnVar: Int) |
| 51 | +@abi(let __abi__abiAttrOnVar: Int) |
49 | 52 | public var abiAttrOnVar: Int = 42 |
50 | 53 | // CHECK: #if {{.*}} $ABIAttribute |
51 | | -// CHECK: @abi(public var __abi__abiAttrOnVar: Swift.Int) |
| 54 | +// CHECK: @abi(var __abi__abiAttrOnVar: Swift.Int) |
52 | 55 | // CHECK: public var abiAttrOnVar: Swift.Int |
53 | 56 | // CHECK: #else |
54 | 57 | // CHECK: @available(*, unavailable, message: "this compiler cannot match the ABI specified by the @abi attribute") |
55 | 58 | // CHECK: public var abiAttrOnVar: Swift.Int |
56 | 59 | // CHECK: #endif |
57 | 60 |
|
| 61 | +public struct MutatingTest { |
| 62 | + // CHECK: #if {{.*}} $ABIAttribute |
| 63 | + // CHECK: @abi(mutating func abiMutFunc()) |
| 64 | + // CHECK: public mutating func abiMutFunc() |
| 65 | + // CHECK: #else |
| 66 | + // CHECK: @_silgen_name("$s5attrs12MutatingTestV10abiMutFuncyyF") |
| 67 | + // CHECK: public mutating func abiMutFunc() |
| 68 | + // CHECK: #endif |
| 69 | + @abi(mutating func abiMutFunc()) |
| 70 | + public mutating func abiMutFunc() {} |
| 71 | +} |
| 72 | + |
| 73 | +// PUBLIC-CHECK-NOT: #if {{.*}} $ABIAttribute |
| 74 | +// PUBLIC-CHECK-NOT: @abi(func abiSpiFunc()) |
| 75 | +// PUBLIC-CHECK-NOT: public func abiSpiFunc() |
| 76 | +// PUBLIC-CHECK-NOT: #else |
| 77 | +// PUBLIC-CHECK-NOT: @_silgen_name("$s5attrs10abiSpiFuncyyF") |
| 78 | +// PUBLIC-CHECK-NOT: public func abiSpiFunc() |
| 79 | +// PUBLIC-CHECK-NOT: #endif |
| 80 | +// PRIVATE-CHECK: #if {{.*}} $ABIAttribute |
| 81 | +// PRIVATE-CHECK: @abi(func abiSpiFunc()) |
| 82 | +// PRIVATE-CHECK: public func abiSpiFunc() |
| 83 | +// PRIVATE-CHECK: #else |
| 84 | +// PRIVATE-CHECK: @_silgen_name("$s5attrs10abiSpiFuncyyF") |
| 85 | +// PRIVATE-CHECK: public func abiSpiFunc() |
| 86 | +// PRIVATE-CHECK: #endif |
| 87 | +@abi(func abiSpiFunc()) |
| 88 | +@_spi(spiGroup) public func abiSpiFunc() {} |
| 89 | + |
58 | 90 | @execution(concurrent) |
59 | 91 | public func testExecutionConcurrent() async {} |
60 | 92 | // CHECK: @execution(concurrent) public func testExecutionConcurrent() async |
|
0 commit comments