|
| 1 | +// RUN: %target-swift-emit-silgen %s | %FileCheck %s |
| 2 | +// RUN: %target-swift-emit-silgen %s -target %target-cpu-apple-macosx10.50 | %FileCheck %s |
| 3 | +// RUN: %target-swift-emit-silgen %s -target %target-cpu-apple-macosx10.60 | %FileCheck %s |
| 4 | +// REQUIRES: OS=macosx |
| 5 | + |
| 6 | +// CHECK-LABEL: sil [serialized] [available 10.51] [ossa] @$s21back_deploy_attribute0A12DeployedFuncyyF : $@convention(thin) () -> () |
| 7 | +@available(macOS 10.51, *) |
| 8 | +@_backDeploy(macOS 10.50) |
| 9 | +public func backDeployedFunc() {} |
| 10 | + |
| 11 | +@available(macOS 10.50, *) |
| 12 | +public struct TopLevelStruct { |
| 13 | + // CHECK-LABEL: sil [serialized] [available 10.51] [ossa] @$s21back_deploy_attribute14TopLevelStructV0a8DeployedF4FuncyyF : $@convention(method) (TopLevelStruct) -> () |
| 14 | + @available(macOS 10.51, *) |
| 15 | + @_backDeploy(macOS 10.50) |
| 16 | + public func backDeployedStructFunc() {} |
| 17 | +} |
| 18 | + |
| 19 | + |
| 20 | +// FIXME(backDeploy): Verify SIL in a caller that requires back deployment |
| 21 | + |
| 22 | + |
| 23 | +// CHECK-LABLEL: sil hidden [available 10.51] [ossa] @$s21back_deploy_attribute21alwaysAvailableCalleryyAA14TopLevelStructVF : $@convention(thin) (TopLevelStruct) -> () |
| 24 | +// CHECK: bb0(%0 : $TopLevelStruct): |
| 25 | +@available(macOS 10.51, *) |
| 26 | +func alwaysAvailableCaller(_ s: TopLevelStruct) { |
| 27 | + /// This function's availability meets the minimum availability of the APIs, so |
| 28 | + /// no back deployment logic is required. |
| 29 | + |
| 30 | + // CHECK: %2 = function_ref @$s21back_deploy_attribute0A12DeployedFuncyyF : $@convention(thin) () -> () |
| 31 | + // CHECK: %3 = apply %2() : $@convention(thin) () -> () |
| 32 | + backDeployedFunc() |
| 33 | + // CHECK: %4 = function_ref @$s21back_deploy_attribute14TopLevelStructV0a8DeployedF4FuncyyF : $@convention(method) (TopLevelStruct) -> () |
| 34 | + // CHECK: %5 = apply %4(%0) : $@convention(method) (TopLevelStruct) -> () |
| 35 | + s.backDeployedStructFunc() |
| 36 | +} |
0 commit comments