File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -module-name without_actually_escaping -emit-silgen -enable-sil-ownership %s | %FileCheck %s
2
+
3
+ // REQUIRES: objc_interop
4
+
5
+ import Foundation
6
+
7
+ typealias Callback = @convention ( block) ( ) -> Void
8
+
9
+ // CHECK-LABEL: sil {{.*}} @$S25without_actually_escaping9testBlock5blockyyyXB_tF
10
+ // CHECK: bb0([[ARG:%.*]] : @guaranteed $@convention(block) @noescape () -> ()):
11
+ // CHECK: [[C1:%.*]] = copy_block [[ARG]]
12
+ // CHECK: [[B1:%.*]] = begin_borrow [[C1]]
13
+ // CHECK: [[C2:%.*]] = copy_value [[B1]]
14
+ // CHECK: [[CVT:%.*]] = convert_function [[C2]] : $@convention(block) @noescape () -> () to $@convention(block) () -> ()
15
+ // CHECK: [[B2:%.*]] = begin_borrow [[CVT]]
16
+ // CHECK: [[FN:%.*]] = function_ref @$S25without_actually_escaping9testBlock5blockyyyXB_tFyyyXBXEfU_
17
+ // CHECK: apply [[FN]]([[B2]])
18
+ // CHECK: end_borrow [[B2]] from [[CVT]]
19
+ // CHECK: destroy_value [[CVT]]
20
+ // CHECK: end_borrow [[B1]] from [[C1]]
21
+ // CHECK: destroy_value [[C1]]
22
+ // CHECK: return
23
+
24
+ func testBlock( block: Callback ) {
25
+ withoutActuallyEscaping ( block) { $0 ( ) }
26
+ }
You can’t perform that action at this time.
0 commit comments