Skip to content

Commit b443dfc

Browse files
committed
[cxx-interop] Add silgen test to check triviality of foreign reference types.
1 parent 4247d96 commit b443dfc

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// RUN: %target-swift-emit-silgen %s -I %S/Inputs -enable-experimental-cxx-interop | %FileCheck %s
2+
//
3+
// XFAIL: OS=linux-android, OS=linux-androideabi
4+
5+
import POD
6+
import ReferenceCounted
7+
8+
// CHECK-LABEL: sil [ossa] @$s4main11testTrivialyyF : $@convention(thin) () -> ()
9+
// CHECK-NOT: retain
10+
// CHECK-NOT: release
11+
// CHECK-NOT: copy_value
12+
// CHECK-NOT: destroy_value
13+
// CHECK-NOT: begin_borrow
14+
// CHECK-NOT: end_borrow
15+
// CHECK: return
16+
// CHECK-LABEL: end sil function '$s4main11testTrivialyyF'
17+
public func testTrivial() {
18+
let x = Empty.create()
19+
let t = (x, x, x)
20+
}
21+
22+
// CHECK-LABEL: sil [ossa] @$s4main14testNonTrivialyyF : $@convention(thin) () -> ()
23+
// CHECK: copy_value %{{[0-9]+}} : $LocalCount
24+
// CHECK: copy_value %{{[0-9]+}} : $LocalCount
25+
// CHECK: copy_value %{{[0-9]+}} : $LocalCount
26+
// CHECK: return
27+
// CHECK-LABEL: end sil function '$s4main14testNonTrivialyyF'
28+
public func testNonTrivial() {
29+
let x = LocalCount.create()
30+
let t = (x, x, x)
31+
}

0 commit comments

Comments
 (0)