1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
// REQUIRES: CPU=i386 || CPU=x86_64
import Builtin
public protocol P1 {
func reqP1a()
}
extension P1 {
func extP1a()
public func extP1b()
}
// CHECK-LABEL: define hidden swiftcc void @_TFP19protocol_extensions2P16extP1aUS0___fQPS0_FT_T_
sil hidden @_TFP19protocol_extensions2P16extP1aUS0___fQPS0_FT_T_ : $@convention(method) <Self where Self : P1> (@in Self) -> () {
bb0(%0 : $*Self):
debug_value %0 : $*Self, let, name "self", expr op_deref // id: %1
%2 = witness_method $Self, #P1.reqP1a : $@convention(witness_method: P1) <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> () // user: %3
%3 = apply %2<Self>(%0) : $@convention(witness_method: P1) <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> ()
destroy_addr %0 : $*Self // id: %4
%5 = tuple () // user: %6
return %5 : $() // id: %6
}
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @_TFP19protocol_extensions2P16extP1bUS0___fQPS0_FT_T_
sil @_TFP19protocol_extensions2P16extP1bUS0___fQPS0_FT_T_ : $@convention(method) <Self where Self : P1> (@in Self) -> () {
bb0(%0 : $*Self):
debug_value %0 : $*Self, let, name "self", expr op_deref // id: %1
// function_ref protocol_extensions.P1.extP1a <A : protocol_extensions.P1>(protocol_extensions.P1.Self)() -> ()
%2 = function_ref @_TFP19protocol_extensions2P16extP1aUS0___fQPS0_FT_T_ : $@convention(method) <τ_0_0 where τ_0_0 : P1> (@in τ_0_0) -> () // user: %5
%3 = alloc_stack $Self // users: %4, %5, %6
copy_addr %0 to [init] %3 : $*Self // id: %4
// CHECK: call swiftcc void @_TFP19protocol_extensions2P16extP1aUS0___fQPS0_FT_T_
%5 = apply %2<Self>(%3) : $@convention(method) <τ_0_0 where τ_0_0 : P1> (@in τ_0_0) -> ()
dealloc_stack %3 : $*Self // id: %6
destroy_addr %0 : $*Self // id: %7
%8 = tuple () // user: %9
return %8 : $() // id: %9
}
|