Files
swift-mirror/test/SILOptimizer/closure_specialize_fragile.swift
Slava Pestov 8fe8b89b0f SIL: Terminology change: [fragile] => [serialized]
Also, add a third [serializable] state for functions whose bodies we
*can* serialize, but only do so if they're referenced from another
serialized function.

This will be used for bodies synthesized for imported definitions,
such as init(rawValue:), etc, and various thunks, but for now this
change is NFC.
2017-03-29 16:47:28 -07:00

20 lines
697 B
Swift

// RUN: %target-swift-frontend %s -emit-sil -O -o - -verify | %FileCheck %s
// Make sure we do not specialize resilientCallee.
// CHECK-LABEL: sil [serialized] [always_inline] @_T026closure_specialize_fragile0C6CalleryyF : $@convention(thin) () -> ()
// CHECK: function_ref @_T026closure_specialize_fragile15resilientCalleeyyyc2fn_tF : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
// CHECK: return
@inline(__always) public func fragileCaller() {
resilientCallee {
print("Hi")
}
}
// CHECK-LABEL: sil @_T026closure_specialize_fragile15resilientCalleeyyyc2fn_tF : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
public func resilientCallee(fn: () -> ()) {
fn()
}