Files
swift-mirror/test/SIL/Serialization/Inputs/generic_shared_function_helper.sil
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

23 lines
999 B
Plaintext

import Swift
@_silgen_name("public_func") public func public_func<T>() -> T?
sil public_external @impl_func : $@convention(thin) <T> () -> @out Optional<T>
sil shared [serialized] @shared_func : $@convention(thin) <T> () -> @out Optional<T> {
bb0(%0 : $*Optional<T>):
%1 = function_ref @impl_func : $@convention(thin) <τ_0_0> () -> @out Optional<τ_0_0> // user: %2
%2 = apply %1<T>(%0) : $@convention(thin) <τ_0_0> () -> @out Optional<τ_0_0>
%3 = tuple () // user: %4
return %3 : $() // id: %4
}
sil public [serialized] @public_func : $@convention(thin) <T> () -> @out Optional<T> {
bb0(%0 : $*Optional<T>):
%1 = function_ref @shared_func : $@convention(thin) <τ_0_0> () -> @out Optional<τ_0_0> // user: %2
%2 = apply %1<T>(%0) : $@convention(thin) <τ_0_0> () -> @out Optional<τ_0_0>
%3 = tuple () // user: %4
return %3 : $() // id: %4
}