Files
swift-mirror/test/SILOptimizer/unavailable_decl_optimization_stub.swift
Allan Shortlidge da2d250105 Tests: Loosen CHECK: lines matching _diagnoseUnavailableCodeReached().
Depending on deployment target and platform, the function called to diagnose
reaching unavailable code could be `_diagnoseUnavailableCodeReached()` itself,
the back-deployment thunk, or the `@_alwaysEmitIntoClient` variant of the
function.

Resolves rdar://121344690
2024-01-29 09:09:26 -08:00

17 lines
863 B
Swift

// RUN: %target-swift-emit-sil -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=stub | %FileCheck %s --check-prefixes=CHECK
public struct S {}
// CHECK-LABEL: sil{{.*}}@$s4Test15unavailableFuncAA1SVyF
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
// CHECK-NEXT: unreachable
// CHECK-NEXT: } // end sil function '$s4Test15unavailableFuncAA1SVyF'
@available(*, unavailable)
public func unavailableFunc() -> S {
// No warning should be produced for this code even though the compiler
// inserted call to _diagnoseUnavailableCodeReached() makes it unreachable.
return S()
}