Skip to content

Commit 8d6783d

Browse files
committed
[IRGen][Test] Update tests for non-Linux platform support.
Tweak the tests slightly for WASM, Windows and Darwin. rdar://23335318
1 parent d0c35cf commit 8d6783d

3 files changed

+26
-10
lines changed

test/IRGen/autorelease.sil

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -enable-objc-interop -emit-ir | %FileCheck -check-prefix CHECK -check-prefix CHECK-%target-ptrsize -check-prefix %target-cpu -DINT=i%target-ptrsize %s
22

3+
// REQUIRES: objc_codegen
4+
35
// rdar://16565958
46

57
import Builtin
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// RUN: %target-swift-frontend -module-name cf_objc_retainAutoreleasedReturnValue -I %S/Inputs %s -enable-objc-interop -emit-ir | %FileCheck %s
2-
// RUN: %target-swift-frontend -module-name cf_objc_retainAutoreleasedReturnValue -I %S/Inputs %s -emit-ir | %FileCheck %s --check-prefix=NO_INTEROP
2+
3+
// We need to require objc_codegen to avoid this test on WASM.
4+
// (That's why the other half of this test is in a separate file.)
5+
6+
// REQUIRES: objc_codegen
37

48
import CFBridgedType
59

@@ -10,15 +14,7 @@ public func foo() {
1014

1115
// With interop enabled, this should use objc_retainAutoreleasedReturnValue()
1216

13-
// CHECK-LABEL: define protected swiftcc void @"$s37cf_objc_retainAutoreleasedReturnValue3fooyyF"()
17+
// CHECK-LABEL: define {{.*}}swiftcc void @"$s37cf_objc_retainAutoreleasedReturnValue3fooyyF"()
1418
// CHECK: entry:
1519
// CHECK: %0 = call {{.*}}@returnsACFBridgedType()
1620
// CHECK: %1 = notail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %0)
17-
18-
// Without interop, it should call swift_retain() instead.
19-
20-
// NO_INTEROP-LABEL: define protected swiftcc void @"$s37cf_objc_retainAutoreleasedReturnValue3fooyyF"()
21-
// NO_INTEROP: entry:
22-
// NO_INTEROP: %0 = call {{.*}}@returnsACFBridgedType()
23-
// NO_INTEROP: %1 = call ptr @swift_retain(ptr returned %0)
24-
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %target-swift-frontend -module-name cf_objc_retainAutoreleasedReturnValue -I %S/Inputs %s -disable-objc-interop -emit-ir | %FileCheck %s
2+
3+
// This is in a separate file because *this* one works on WASM.
4+
// (cf_objc_retainAutoreleasedReturnValue.swift does not.)
5+
6+
import CFBridgedType
7+
8+
@inline(never)
9+
public func foo() {
10+
let _ = returnsACFBridgedType()
11+
}
12+
13+
// With interop disabled, this should use swift_retain().
14+
15+
// CHECK-LABEL: define {{.*}}swiftcc void @"$s37cf_objc_retainAutoreleasedReturnValue3fooyyF"()
16+
// CHECK: entry:
17+
// CHECK: %0 = call {{.*}}@returnsACFBridgedType()
18+
// CHECK: %1 = call ptr @swift_retain(ptr returned %0)

0 commit comments

Comments
 (0)