mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Although nonescaping closures are representationally trivial pointers to their on-stack context, it is useful to model them as borrowing their captures, which allows for checking correct use of move-only values across the closure, and lets us model the lifetime dependence between a closure and its captures without an ad-hoc web of `mark_dependence` instructions. During ownership elimination, We eliminate copy/destroy_value instructions and end the partial_apply's lifetime with an explicit dealloc_stack as before, for compatibility with existing IRGen and non-OSSA aware passes.
14 lines
496 B
Swift
14 lines
496 B
Swift
// RUN: %target-swift-frontend -emit-sil %s | %FileCheck %s
|
|
|
|
@_transparent func takesGenericAutoclosure<T>(_ fn: @autoclosure () -> T) {
|
|
_ = fn()
|
|
}
|
|
|
|
// CHECK-LABEL: sil hidden @$s38mandatory_inlining_generic_autoclosure23callsGenericAutoclosureyyxlF : $@convention(thin) <T> (@in_guaranteed T) -> () {
|
|
// FIXME
|
|
// CHE/CK-NOT: function_ref @$s38mandatory_inlining_generic_autoclosure23callsGenericAutoclosureyyxlFxyXEfu_
|
|
|
|
func callsGenericAutoclosure<T>(_ t: T) {
|
|
takesGenericAutoclosure(t)
|
|
}
|