Skip to content

Commit 6a47011

Browse files
committed
[cxx-interop] add IRGen test for field base accessors for non-copyable fields
1 parent bacc58e commit 6a47011

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// RUN: %target-swift-emit-irgen -I %S/Inputs -enable-experimental-cxx-interop %s -validate-tbd-against-ir=none -Xcc -fignore-exceptions | %FileCheck %s
2+
3+
import MoveOnlyCxxValueType
4+
5+
func testGetX() -> CInt {
6+
let derived = NonCopyableHolderDerivedDerived(42)
7+
return derived.x.x
8+
}
9+
10+
let _ = testGetX()
11+
12+
func testSetX(_ x: CInt) {
13+
var derived = NonCopyableHolderDerivedDerived(42)
14+
derived.x.x = 2
15+
}
16+
17+
testSetX(2)
18+
19+
// CHECK: define {{.*}}linkonce_odr{{.*}} ptr @{{.*}}__synthesizedBaseCall___synthesizedBaseGetterAccessor{{.*}}
20+
21+
// CHECK: define {{.*}}linkonce_odr{{.*}} ptr @{{.*}}__synthesizedBaseCall___synthesizedBaseSetterAccessor{{.*}}
22+
23+
// CHECK: define {{.*}}linkonce_odr{{.*}} ptr @{{.*}}__synthesizedBaseGetterAccessor{{.*}}
24+
// CHECK: %[[VPTR:.*]] = getelementptr inbounds %struct.NonCopyableHolder
25+
// CHECK: ret ptr %[[VPTR]]
26+
27+
// CHECK: define {{.*}}linkonce_odr{{.*}} ptr @{{.*}}__synthesizedBaseSetterAccessor{{.*}}
28+
// CHECK: %[[VPTRS:.*]] = getelementptr inbounds %struct.NonCopyableHolder
29+
// CHECK: ret ptr %[[VPTRS]]

0 commit comments

Comments
 (0)