Skip to content

Commit 398b0de

Browse files
committed
Tests: Simplify unavailable_decl_optimization_stub_macos.swift.
Extract the tests that verify back deployment of the standard library function `diagnoseUnavailableCodeReached()` into a separate, multi-platform test.
1 parent fc2b5be commit 398b0de

File tree

2 files changed

+38
-12
lines changed

2 files changed

+38
-12
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// RUN: %target-swift-emit-silgen -target %target-swift-5.8-abi-triple -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=stub | %FileCheck %s --check-prefixes=CHECK,CHECK-SWIFT5_8
2+
// RUN: %target-swift-emit-silgen -target %target-swift-5.9-abi-triple -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=stub | %FileCheck %s --check-prefixes=CHECK,CHECK-SWIFT5_9
3+
4+
// REQUIRES: OS=macosx || OS=ios || OS=tvos || OS=watchos
5+
6+
// CHECK-LABEL: sil{{.*}}@$s4Test15unavailableFuncyyF
7+
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
8+
// CHECK-SWIFT5_9: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyF : $@convention(thin) () -> Never
9+
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
10+
// CHECK: } // end sil function '$s4Test15unavailableFuncyyF'
11+
@available(*, unavailable)
12+
public func unavailableFunc() {}
13+
14+
// CHECK-LABEL: sil{{.*}}@$s4Test24unavailableInlinableFuncyyF
15+
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
16+
// CHECK-SWIFT5_9: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
17+
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
18+
// CHECK: } // end sil function '$s4Test24unavailableInlinableFuncyyF'
19+
@available(*, unavailable)
20+
@inlinable public func unavailableInlinableFunc() {}
21+
22+
// CHECK-LABEL: sil{{.*}}@$s4Test27unavailableOnOSPlatformFuncyyF
23+
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
24+
// CHECK-SWIFT5_9: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyF : $@convention(thin) () -> Never
25+
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
26+
// CHECK: } // end sil function '$s4Test27unavailableOnOSPlatformFuncyyF'
27+
@available(macOS, unavailable)
28+
@available(iOS, unavailable)
29+
@available(tvOS, unavailable)
30+
@available(watchOS, unavailable)
31+
public func unavailableOnOSPlatformFunc() {}
32+

test/SILGen/unavailable_decl_optimization_stub_macos.swift

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
1-
// RUN: %target-swift-emit-silgen -target %target-swift-5.8-abi-triple -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=stub | %FileCheck %s --check-prefixes=CHECK,CHECK-SWIFT5_8
2-
// RUN: %target-swift-emit-silgen -target %target-swift-5.8-abi-triple -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=stub -application-extension | %FileCheck %s --check-prefixes=CHECK,CHECK-SWIFT5_8
3-
// RUN: %target-swift-emit-silgen -target %target-swift-5.9-abi-triple -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=stub | %FileCheck %s --check-prefixes=CHECK,CHECK-SWIFT5_9
4-
// RUN: %target-swift-emit-silgen -target %target-swift-5.9-abi-triple -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=stub -application-extension | %FileCheck %s --check-prefixes=CHECK,CHECK-SWIFT5_9
1+
// RUN: %target-swift-emit-silgen -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=stub | %FileCheck %s --check-prefixes=CHECK
2+
// RUN: %target-swift-emit-silgen -target %target-swift-5.8-abi-triple -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=stub -application-extension | %FileCheck %s --check-prefixes=CHECK
53

64
// REQUIRES: OS=macosx
75

86
// CHECK-LABEL: sil{{.*}}@$s4Test15unavailableFuncyyF
9-
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
10-
// CHECK-SWIFT5_9: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyF : $@convention(thin) () -> Never
7+
// CHECK: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
118
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
129
// CHECK: } // end sil function '$s4Test15unavailableFuncyyF'
1310
@available(*, unavailable)
1411
public func unavailableFunc() {}
1512

1613
// CHECK-LABEL: sil{{.*}}@$s4Test24unavailableInlinableFuncyyF
17-
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
18-
// CHECK-SWIFT5_9: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
14+
// CHECK: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
1915
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
2016
// CHECK: } // end sil function '$s4Test24unavailableInlinableFuncyyF'
2117
@available(*, unavailable)
2218
@inlinable public func unavailableInlinableFunc() {}
2319

2420
// CHECK-LABEL: sil{{.*}}@$s4Test22unavailableOnMacOSFuncyyF
25-
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
26-
// CHECK-SWIFT5_9: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyF : $@convention(thin) () -> Never
21+
// CHECK: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
2722
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
2823
// CHECK: } // end sil function '$s4Test22unavailableOnMacOSFuncyyF'
2924
@available(macOS, unavailable)
@@ -36,8 +31,7 @@ public func unavailableOnMacOSFunc() {}
3631
public func unavailableOnMacOSExtensionFunc() {}
3732

3833
// CHECK-LABEL: sil{{.*}}@$s4Test021unavailableOnMacOSAndD15OSExtensionFuncyyF
39-
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
40-
// CHECK-SWIFT5_9: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyF : $@convention(thin) () -> Never
34+
// CHECK: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
4135
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
4236
// CHECK: } // end sil function '$s4Test021unavailableOnMacOSAndD15OSExtensionFuncyyF'
4337
@available(macOS, unavailable)

0 commit comments

Comments
 (0)