|
1 |
| -// RUN: %target-swift-frontend %s -emit-silgen -swift-version 6 | swift-demangle | %FileCheck -check-prefix=CHECK %s |
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %target-swift-frontend %s -emit-silgen -swift-version 6 | swift-demangle | %FileCheck %s |
| 3 | +// RUN: %target-swift-frontend %s -emit-silgen -swift-version 6 | %FileCheck -check-prefix=SIL %s |
2 | 4 |
|
3 | 5 | // REQUIRES: concurrency
|
4 | 6 | // REQUIRES: asserts
|
@@ -110,3 +112,21 @@ struct ConstructorSharedTest {
|
110 | 112 | // CHECK: sil hidden [ossa] @sending_mangling.ConstructorSharedTest.functionSuppressed(sending_mangling.NonSendableKlass) -> () : $@convention(method) (@sil_sending @guaranteed NonSendableKlass, ConstructorSharedTest) -> () {
|
111 | 113 | func functionSuppressed(_ x: __shared sending NonSendableKlass) {}
|
112 | 114 | }
|
| 115 | + |
| 116 | +// Make sure that we produce the appropriate reabstraction thunk. |
| 117 | +func reabstractionThunkTest_takeSendingReturnSending<T>( |
| 118 | + _ x: sending T) -> sending T { fatalError() } |
| 119 | +func reabstractionThunkTest_reabstractionThunkGenerator<T>( |
| 120 | + _ x: sending T, |
| 121 | + _ f: (sending T) -> T) {} |
| 122 | + |
| 123 | +// CHECK: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @reabstraction thunk helper from @escaping @callee_guaranteed (@in sending sending_mangling.NonSendableKlass) -> sending (@out sending_mangling.NonSendableKlass) to @escaping @callee_guaranteed (@owned sending sending_mangling.NonSendableKlass) -> sending (@owned sending_mangling.NonSendableKlass) : $@convention(thin) (@sil_sending @owned NonSendableKlass, @guaranteed @callee_guaranteed (@sil_sending @in NonSendableKlass) -> @sil_sending @out NonSendableKlass) -> @sil_sending @owned NonSendableKlass { |
| 124 | +// SIL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$s16sending_mangling16NonSendableKlassCACIegTiTr_A2CIegTxTo_TR : $@convention(thin) (@sil_sending @owned NonSendableKlass, @guaranteed @callee_guaranteed (@sil_sending @in NonSendableKlass) -> @sil_sending @out NonSendableKlass) -> @sil_sending @owned NonSendableKlass { |
| 125 | + |
| 126 | +// CHECK: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @reabstraction thunk helper from @callee_guaranteed (@owned sending sending_mangling.NonSendableKlass) -> (@owned sending_mangling.NonSendableKlass) to @escaping @callee_guaranteed (@in sending sending_mangling.NonSendableKlass) -> (@out sending_mangling.NonSendableKlass) : $@convention(thin) (@sil_sending @in NonSendableKlass, @guaranteed @noescape @callee_guaranteed (@sil_sending @owned NonSendableKlass) -> @owned NonSendableKlass) -> @out NonSendableKlass { |
| 127 | +// SIL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$s16sending_mangling16NonSendableKlassCACIgxTo_A2CIegiTr_TR : $@convention(thin) (@sil_sending @in NonSendableKlass, @guaranteed @noescape @callee_guaranteed (@sil_sending @owned NonSendableKlass) -> @owned NonSendableKlass) -> @out NonSendableKlass { |
| 128 | +func reabstractionThunkTest() { |
| 129 | + reabstractionThunkTest_reabstractionThunkGenerator( |
| 130 | + NonSendableKlass(), |
| 131 | + reabstractionThunkTest_takeSendingReturnSending) |
| 132 | +} |
0 commit comments