Skip to content

Commit c77593a

Browse files
authored
Merge pull request #73536 from apple/egorzhdan/frt-tests
[cxx-interop] Fixes for tests for foreign reference types
2 parents 2d61e3d + 27829b7 commit c77593a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

test/Interop/Cxx/foreign-reference/reference-counted-irgen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public func getNullable(wantNullptr: Bool) -> GlobalCountNullableInit? {
3636
return result
3737
}
3838

39-
// CHECK: define {{.*}}swiftcc i64 @"$s4main11getNullable11wantNullptrSo011GlobalCountC4InitVSgSb_tF"(i1 %0)
39+
// CHECK: define {{.*}}swiftcc i{{.*}} @"$s4main11getNullable11wantNullptrSo011GlobalCountC4InitVSgSb_tF"(i1 %0)
4040
// CHECK-NEXT: entry:
4141
// CHECK: %1 = call ptr @{{_ZN23GlobalCountNullableInit6createEb|"\?create\@GlobalCountNullableInit\@\@SAPEAU1\@_N\@Z"}}
4242
// CHECK-NEXT: %2 = ptrtoint ptr %1 to i64

test/Interop/Cxx/foreign-reference/reference-counted.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -enable-experimental-cxx-interop -Xfrontend -validate-tbd-against-ir=none -Xfrontend -disable-llvm-verify -Xfrontend -disable-availability-checking)
1+
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -enable-experimental-cxx-interop -Xfrontend -validate-tbd-against-ir=none -Xfrontend -disable-llvm-verify -Xfrontend -disable-availability-checking -Onone -D NO_OPTIMIZATIONS)
2+
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -enable-experimental-cxx-interop -Xfrontend -validate-tbd-against-ir=none -Xfrontend -disable-llvm-verify -Xfrontend -disable-availability-checking -O)
23
//
34
// REQUIRES: executable_test
45
// TODO: This should work without ObjC interop in the future rdar://97497120
@@ -15,13 +16,17 @@ public func blackHole<T>(_ _: T) { }
1516
@inline(never)
1617
func localTest() {
1718
var x = NS.LocalCount.create()
19+
#if NO_OPTIMIZATIONS
1820
expectEqual(x.value, 8) // This is 8 because of "var x" "x.value" * 2, two method calls on x, and "(x, x, x)".
21+
#endif
1922

2023
expectEqual(x.returns42(), 42)
2124
expectEqual(x.constMethod(), 42)
2225

2326
let t = (x, x, x)
27+
#if NO_OPTIMIZATIONS
2428
expectEqual(x.value, 5)
29+
#endif
2530
}
2631

2732
ReferenceCountedTestSuite.test("Local") {
@@ -41,14 +46,18 @@ ReferenceCountedTestSuite.test("Global optional holding local ref count") {
4146
func globalTest1() {
4247
var x = GlobalCount.create()
4348
let t = (x, x, x)
49+
#if NO_OPTIMIZATIONS
4450
expectEqual(globalCount, 4)
51+
#endif
4552
blackHole(t)
4653
}
4754

4855
@inline(never)
4956
func globalTest2() {
5057
var x = GlobalCount.create()
58+
#if NO_OPTIMIZATIONS
5159
expectEqual(globalCount, 1)
60+
#endif
5261
}
5362

5463
ReferenceCountedTestSuite.test("Global") {

0 commit comments

Comments
 (0)