mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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.
23 lines
999 B
Plaintext
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
|
|
}
|