|
| 1 | + // RUN: %empty-directory(%t) |
| 2 | + |
| 3 | +// RUN: %target-swift-frontend -module-name=Lib -package-name libpkg -emit-silgen %s -enable-library-evolution -wmo -o %t/Lib-no-pcmo-silgen.sil |
| 4 | + |
| 5 | +// RUN: %target-swift-frontend -module-name=Lib -package-name libpkg -emit-sil %s -enable-library-evolution -wmo -o %t/Lib-no-pcmo-sil.sil |
| 6 | + |
| 7 | +// RUN: %target-swift-frontend -module-name=Lib -package-name libpkg -emit-ir %s -enable-library-evolution -wmo -o %t/Lib-no-pcmo-ir.ll -emit-tbd-path %t/Lib-no-pcmo-tbd.tbd -tbd-install_name Lib |
| 8 | + |
| 9 | +// RUN: %target-swift-frontend -module-name=Lib -package-name libpkg -emit-silgen %s -enable-library-evolution -wmo -allow-non-resilient-access -package-cmo -o %t/Lib-silgen.sil |
| 10 | + |
| 11 | +// RUN: %target-swift-frontend -module-name=Lib -package-name libpkg -emit-sil %s -enable-library-evolution -wmo -allow-non-resilient-access -package-cmo -o %t/Lib-sil.sil |
| 12 | + |
| 13 | +// RUN: %target-swift-frontend -module-name=Lib -package-name libpkg -emit-ir %s -enable-library-evolution -wmo -allow-non-resilient-access -package-cmo -o %t/Lib-ir.ll -emit-tbd-path %t/Lib-tbd.tbd -tbd-install_name Lib |
| 14 | + |
| 15 | +// RUN: %FileCheck %s --check-prefix=CHECK-NO-PCMO-SILGEN < %t/Lib-no-pcmo-silgen.sil |
| 16 | +// RUN: %FileCheck %s --check-prefix=CHECK-NO-PCMO-SIL < %t/Lib-no-pcmo-sil.sil |
| 17 | +// RUN: %FileCheck %s --check-prefix=CHECK-NO-PCMO-IR < %t/Lib-no-pcmo-ir.ll |
| 18 | +// RUN: %FileCheck %s --check-prefix=CHECK-NO-PCMO-TBD < %t/Lib-no-pcmo-tbd.tbd |
| 19 | +// RUN: %FileCheck %s --check-prefix=CHECK-SILGEN < %t/Lib-silgen.sil |
| 20 | +// RUN: %FileCheck %s --check-prefix=CHECK-SIL < %t/Lib-sil.sil |
| 21 | +// RUN: %FileCheck %s --check-prefix=CHECK-IR < %t/Lib-ir.ll |
| 22 | +// RUN: %FileCheck %s --check-prefix=CHECK-TBD < %t/Lib-tbd.tbd |
| 23 | + |
| 24 | + |
| 25 | +/// TEST that a public (or package) protocol witness thunk gets a shared linkage if Package CMO is enabled. |
| 26 | +/// It also gets [serialized] in emit-silgen. |
| 27 | +/// |
| 28 | +// protocol witness for Proto.foo.getter in conformance Pub |
| 29 | + |
| 30 | +// CHECK-NO-PCMO-SILGEN-DAG: sil private [transparent] [thunk] [ossa] @$s3Lib3PubVAA5ProtoA2aDP3fooSSvgTW : $@convention(witness_method: Proto) (@in_guaranteed Pub) -> @owned String { |
| 31 | +// CHECK-SILGEN-DAG: sil shared [transparent] [serialized] [thunk] [ossa] @$s3Lib3PubVAA5ProtoA2aDP3fooSSvgTW : $@convention(witness_method: Proto) (@in_guaranteed Pub) -> @owned String { |
| 32 | + |
| 33 | +// CHECK-NO-PCMO-SIL-DAG: sil private [transparent] [thunk] @$s3Lib3PubVAA5ProtoA2aDP3fooSSvgTW : $@convention(witness_method: Proto) (@in_guaranteed Pub) -> @owned String { |
| 34 | +// CHECK-SIL-DAG: sil shared [transparent] [thunk] @$s3Lib3PubVAA5ProtoA2aDP3fooSSvgTW : $@convention(witness_method: Proto) (@in_guaranteed Pub) -> @owned String { |
| 35 | + |
| 36 | +// CHECK-NO-PCMO-IR-DAG: define internal swiftcc { {{i64|i32}}, ptr } @"$s3Lib3PubVAA5ProtoA2aDP3fooSSvgTW" |
| 37 | +// CHECK-IR-DAG: define linkonce_odr hidden swiftcc { {{i64|i32}}, ptr } @"$s3Lib3PubVAA5ProtoA2aDP3fooSSvgTW" |
| 38 | + |
| 39 | +// protocol witness for Proto.bar(_:) in conformance Pub |
| 40 | + |
| 41 | +// CHECK-NO-PCMO-SILGEN-DAG: sil private [transparent] [thunk] [ossa] @$s3Lib3PubVAA5ProtoA2aDP3baryS2iFTW : $@convention(witness_method: Proto) (Int, @in_guaranteed Pub) -> Int { |
| 42 | +// CHECK-SILGEN-DAG: sil shared [transparent] [serialized] [thunk] [ossa] @$s3Lib3PubVAA5ProtoA2aDP3baryS2iFTW : $@convention(witness_method: Proto) (Int, @in_guaranteed Pub) -> Int { |
| 43 | + |
| 44 | +// CHECK-NO-PCMO-SIL-DAG: sil private [transparent] [thunk] @$s3Lib3PubVAA5ProtoA2aDP3baryS2iFTW : $@convention(witness_method: Proto) (Int, @in_guaranteed Pub) -> Int { |
| 45 | +// CHECK-SIL-DAG: sil shared [transparent] [thunk] @$s3Lib3PubVAA5ProtoA2aDP3baryS2iFTW : $@convention(witness_method: Proto) (Int, @in_guaranteed Pub) -> Int { |
| 46 | + |
| 47 | +// CHECK-NO-PCMO-IR-DAG: define internal swiftcc {{i64|i32}} @"$s3Lib3PubVAA5ProtoA2aDP3baryS2iFTW" |
| 48 | +// CHECK-IR-DAG: define linkonce_odr hidden swiftcc i64 @"$s3Lib3PubVAA5ProtoA2aDP3baryS2iFTW" |
| 49 | + |
| 50 | +// CHECK-NO-PCMO-TBD-NOT: s3Lib3PubVAA5ProtoA2aDP3fooSSvgTW |
| 51 | +// CHECK-NO-PCMO-TBD-NOT: s3Lib3PubVAA5ProtoA2aDP3baryS2iFTW |
| 52 | +// CHECK-TBD-NOT: s3Lib3PubVAA5ProtoA2aDP3fooSSvgTW |
| 53 | +// CHECK-TBD-NOT: s3Lib3PubVAA5ProtoA2aDP3baryS2iFTW |
| 54 | + |
| 55 | +public protocol Proto { |
| 56 | + var foo: String { get set } |
| 57 | + func bar(_ arg: Int) -> Int |
| 58 | +} |
| 59 | + |
| 60 | +public struct Pub: Proto { |
| 61 | + public var foo = "foo" |
| 62 | + public func bar(_ arg: Int) -> Int { |
| 63 | + return arg |
| 64 | + } |
| 65 | +} |
0 commit comments