mirror of
https://github.com/apple/swift.git
synced 2025-12-25 12:15:36 +01:00
The old syntax was
@opened("UUID") constraintType
Where constraintType was the right hand side of a conformance requirement.
This would always create an archetype where the interface type was `Self`,
so it couldn't cope with member types of opened existential types.
Member types of opened existential types is now a thing with SE-0309, so
this lack of support prevented writing SIL test cases using this feature.
The new syntax is
@opened("UUID", constraintType) interfaceType
The interfaceType is a type parameter rooted in an implicit `Self`
generic parameter, which is understood to be the underlying type of the
existential.
Fixes rdar://problem/93771238.
721 lines
28 KiB
Plaintext
721 lines
28 KiB
Plaintext
// RUN: %target-sil-opt -sil-print-debuginfo -enable-sil-verify-all %s -basic-callee-printer -o /dev/null | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOWMO %s
|
|
// RUN: %target-sil-opt -sil-print-debuginfo -enable-sil-verify-all %s -wmo -basic-callee-printer -o /dev/null | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-WMO %s
|
|
|
|
sil_stage canonical
|
|
|
|
sil private @private_bottom : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = tuple ()
|
|
return %0 : $()
|
|
}
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: // function_ref private_bottom
|
|
// CHECK: %0 = function_ref @private_bottom : $@convention(thin) () -> (){{.*}} // user: %1
|
|
// CHECK: %1 = apply %0() : $@convention(thin) () -> ()
|
|
// CHECK: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: private_bottom
|
|
sil private @private_middle : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @private_bottom : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: // function_ref private_middle
|
|
// CHECK: %0 = function_ref @private_middle : $@convention(thin) () -> (){{.*}} // user: %1
|
|
// CHECK: %1 = apply %0() : $@convention(thin) () -> ()
|
|
// CHECK: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: private_middle
|
|
sil private @private_top : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @private_middle : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
sil hidden @internal_bottom : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = tuple ()
|
|
return %0 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: // function_ref internal_bottom
|
|
// CHECK: %0 = function_ref @internal_bottom : $@convention(thin) () -> (){{.*}} // user: %1
|
|
// CHECK: %1 = apply %0() : $@convention(thin) () -> ()
|
|
// CHECK: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: internal_bottom
|
|
sil hidden @internal_middle : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @internal_bottom : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: // function_ref internal_middle
|
|
// CHECK: %0 = function_ref @internal_middle : $@convention(thin) () -> (){{.*}} // user: %1
|
|
// CHECK: %1 = apply %0() : $@convention(thin) () -> ()
|
|
// CHECK: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: internal_middle
|
|
sil hidden @internal_top : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @internal_middle : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
sil @public_bottom : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = tuple ()
|
|
return %0 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: // function_ref public_bottom
|
|
// CHECK: %0 = function_ref @public_bottom : $@convention(thin) () -> (){{.*}} // user: %1
|
|
// CHECK: %1 = apply %0() : $@convention(thin) () -> ()
|
|
// CHECK: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: public_bottom
|
|
sil @public_middle : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @public_bottom : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: // function_ref public_middle
|
|
// CHECK: %0 = function_ref @public_middle : $@convention(thin) () -> (){{.*}} // user: %1
|
|
// CHECK: %1 = apply %0() : $@convention(thin) () -> ()
|
|
// CHECK: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: public_middle
|
|
sil @public_top : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @public_middle : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
private class private_base {
|
|
func foo()
|
|
}
|
|
|
|
private class private_derived : private_base {
|
|
override func foo()
|
|
}
|
|
|
|
@inline(never) private func call_private(b: private_base)
|
|
|
|
class internal_base {
|
|
func foo()
|
|
private func bar()
|
|
}
|
|
|
|
class internal_derived : internal_base {
|
|
override func foo()
|
|
override func bar()
|
|
}
|
|
|
|
@inline(never) func call_internal(b: internal_base)
|
|
|
|
open class public_base {
|
|
func foo()
|
|
open func bar()
|
|
private func baz()
|
|
}
|
|
|
|
open class public_derived : public_base {
|
|
override func foo()
|
|
open override func bar()
|
|
open override func baz()
|
|
}
|
|
|
|
|
|
sil private @private_base_foo : $@convention(method) (@guaranteed private_base) -> () {
|
|
bb0(%0 : $private_base):
|
|
debug_value %0 : $private_base
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
sil private @private_derived_foo : $@convention(method) (@guaranteed private_derived) -> () {
|
|
bb0(%0 : $private_derived):
|
|
debug_value %0 : $private_derived
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %2 = class_method %0 : $private_base, #private_base.foo : (private_base) -> () -> (), $@convention(method) (@guaranteed private_base) -> (),{{.*}} // user: %3
|
|
// CHECK: %3 = apply %2(%0) : $@convention(method) (@guaranteed private_base) -> ()
|
|
// CHECK: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: private_base_foo
|
|
// CHECK: private_derived_foo
|
|
sil private [noinline] @call_private : $@convention(thin) (@owned private_base) -> () {
|
|
bb0(%0 : $private_base):
|
|
debug_value %0 : $private_base
|
|
%2 = class_method %0 : $private_base, #private_base.foo : (private_base) -> () -> (), $@convention(method) (@guaranteed private_base) -> ()
|
|
%3 = apply %2(%0) : $@convention(method) (@guaranteed private_base) -> ()
|
|
strong_release %0 : $private_base
|
|
%5 = tuple ()
|
|
return %5 : $()
|
|
}
|
|
|
|
|
|
sil hidden @internal_base_foo : $@convention(method) (@guaranteed internal_base) -> () {
|
|
bb0(%0 : $internal_base):
|
|
debug_value %0 : $internal_base
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
sil private @internal_base_bar : $@convention(method) (@guaranteed internal_base) -> () {
|
|
bb0(%0 : $internal_base):
|
|
debug_value %0 : $internal_base
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
sil hidden @internal_derived_foo : $@convention(method) (@guaranteed internal_derived) -> () {
|
|
bb0(%0 : $internal_derived):
|
|
debug_value %0 : $internal_derived
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
sil hidden @internal_derived_bar : $@convention(method) (@guaranteed internal_derived) -> () {
|
|
bb0(%0 : $internal_derived):
|
|
debug_value %0 : $internal_derived
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %2 = class_method %0 : $internal_base, #internal_base.foo : (internal_base) -> () -> (), $@convention(method) (@guaranteed internal_base) -> ()
|
|
// CHECK: %3 = apply %2(%0) : $@convention(method) (@guaranteed internal_base) -> ()
|
|
// CHECK-NOWMO: Incomplete callee list? : Yes
|
|
// CHECK-WMO: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: internal_base_foo
|
|
// CHECK: internal_derived_foo
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %4 = class_method %0 : $internal_base, #internal_base.bar : (internal_base) -> () -> (), $@convention(method) (@guaranteed internal_base) -> (){{.*}} // user: %5
|
|
// CHECK: %5 = apply %4(%0) : $@convention(method) (@guaranteed internal_base) -> ()
|
|
// CHECK-NOWMO: Incomplete callee list? : Yes
|
|
// CHECK-WMO: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: internal_base_bar
|
|
// CHECK: internal_derived_bar
|
|
sil hidden [noinline] @call_internal : $@convention(thin) (@owned internal_base) -> () {
|
|
bb0(%0 : $internal_base):
|
|
debug_value %0 : $internal_base
|
|
%2 = class_method %0 : $internal_base, #internal_base.foo : (internal_base) -> () -> (), $@convention(method) (@guaranteed internal_base) -> ()
|
|
%3 = apply %2(%0) : $@convention(method) (@guaranteed internal_base) -> ()
|
|
%4 = class_method %0 : $internal_base, #internal_base.bar : (internal_base) -> () -> (), $@convention(method) (@guaranteed internal_base) -> ()
|
|
%5 = apply %4(%0) : $@convention(method) (@guaranteed internal_base) -> ()
|
|
strong_release %0 : $internal_base
|
|
%7 = tuple ()
|
|
return %7 : $()
|
|
}
|
|
|
|
|
|
sil hidden @public_base_foo : $@convention(method) (@guaranteed public_base) -> () {
|
|
bb0(%0 : $public_base):
|
|
debug_value %0 : $public_base
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
sil @public_base_bar : $@convention(method) (@guaranteed public_base) -> () {
|
|
bb0(%0 : $public_base):
|
|
debug_value %0 : $public_base
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
sil private @public_base_baz : $@convention(method) (@guaranteed public_base) -> () {
|
|
bb0(%0 : $public_base):
|
|
debug_value %0 : $public_base
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
sil hidden @public_derived_foo : $@convention(method) (@guaranteed public_derived) -> () {
|
|
bb0(%0 : $public_derived):
|
|
debug_value %0 : $public_derived
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
sil @public_derived_bar : $@convention(method) (@guaranteed public_derived) -> () {
|
|
bb0(%0 : $public_derived):
|
|
debug_value %0 : $public_derived
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
sil @public_derived_baz : $@convention(method) (@guaranteed public_derived) -> () {
|
|
bb0(%0 : $public_derived):
|
|
debug_value %0 : $public_derived
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %2 = class_method %0 : $public_base, #public_base.foo : (public_base) -> () -> (), $@convention(method) (@guaranteed public_base) -> (){{.*}} // user: %3
|
|
// CHECK: %3 = apply %2(%0) : $@convention(method) (@guaranteed public_base) -> ()
|
|
// CHECK-NOWMO: Incomplete callee list? : Yes
|
|
// CHECK-WMO: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: public_base_foo
|
|
// CHECK: public_derived_foo
|
|
//
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %4 = class_method %0 : $public_base, #public_base.bar : (public_base) -> () -> (), $@convention(method) (@guaranteed public_base) -> (){{.*}} // user: %5
|
|
// CHECK: %5 = apply %4(%0) : $@convention(method) (@guaranteed public_base) -> ()
|
|
// CHECK: Incomplete callee list? : Yes
|
|
// CHECK: Known callees:
|
|
// CHECK: public_base_bar
|
|
// CHECK: public_derived_bar
|
|
//
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %6 = class_method %0 : $public_base, #public_base.baz : (public_base) -> () -> (), $@convention(method) (@guaranteed public_base) -> (){{.*}} // user: %7
|
|
// CHECK: %7 = apply %6(%0) : $@convention(method) (@guaranteed public_base) -> ()
|
|
// CHECK: Incomplete callee list? : Yes
|
|
// CHECK: Known callees:
|
|
// CHECK: public_base_baz
|
|
// CHECK: public_derived_baz
|
|
sil hidden [noinline] @call_public : $@convention(thin) (@owned public_base) -> () {
|
|
bb0(%0 : $public_base):
|
|
debug_value %0 : $public_base
|
|
%2 = class_method %0 : $public_base, #public_base.foo : (public_base) -> () -> (), $@convention(method) (@guaranteed public_base) -> ()
|
|
%3 = apply %2(%0) : $@convention(method) (@guaranteed public_base) -> ()
|
|
%4 = class_method %0 : $public_base, #public_base.bar : (public_base) -> () -> (), $@convention(method) (@guaranteed public_base) -> ()
|
|
%5 = apply %4(%0) : $@convention(method) (@guaranteed public_base) -> ()
|
|
%6 = class_method %0 : $public_base, #public_base.baz : (public_base) -> () -> (), $@convention(method) (@guaranteed public_base) -> ()
|
|
%7 = apply %6(%0) : $@convention(method) (@guaranteed public_base) -> ()
|
|
strong_release %0 : $public_base
|
|
%9 = tuple ()
|
|
return %9 : $()
|
|
}
|
|
|
|
sil_vtable private_base {
|
|
#private_base.foo: @private_base_foo
|
|
}
|
|
|
|
sil_vtable private_derived {
|
|
#private_base.foo: @private_derived_foo [override]
|
|
}
|
|
|
|
sil_vtable internal_base {
|
|
#internal_base.foo: @internal_base_foo
|
|
#internal_base.bar: @internal_base_bar
|
|
}
|
|
|
|
sil_vtable internal_derived {
|
|
#internal_base.foo: @internal_derived_foo [override]
|
|
#internal_base.bar: @internal_derived_bar [override]
|
|
}
|
|
|
|
sil_vtable public_base {
|
|
#public_base.foo: @public_base_foo
|
|
#public_base.bar: @public_base_bar
|
|
#public_base.baz: @public_base_baz
|
|
}
|
|
|
|
sil_vtable public_derived {
|
|
#public_base.foo: @public_derived_foo [override]
|
|
#public_base.bar: @public_derived_bar [override]
|
|
#public_base.baz: @public_derived_baz [override]
|
|
}
|
|
|
|
private protocol private_proto_1 {
|
|
func theMethod()
|
|
}
|
|
|
|
private class private_proto_private_class : private_proto_1 {
|
|
func theMethod()
|
|
}
|
|
|
|
private func call_through_private_proto_1<T : private_proto_1>(x: T)
|
|
|
|
private protocol private_proto_2 {
|
|
func theMethod()
|
|
}
|
|
|
|
class private_proto_internal_class : private_proto_2 {
|
|
func theMethod()
|
|
}
|
|
|
|
private func call_through_private_proto_2<T : private_proto_2>(x: T)
|
|
|
|
private protocol private_proto_3 {
|
|
func theMethod()
|
|
}
|
|
|
|
open class private_proto_public_class : private_proto_3 {
|
|
open func theMethod()
|
|
}
|
|
|
|
private func call_through_private_proto_3<T : private_proto_3>(x: T)
|
|
|
|
private protocol private_proto_4 {
|
|
func theMethod()
|
|
}
|
|
|
|
open class private_proto_public_class_private_method : private_proto_4 {
|
|
fileprivate func theMethod()
|
|
}
|
|
|
|
private func call_through_private_proto_4<T : private_proto_4>(x: T)
|
|
|
|
sil private @private_proto_private_class_theMethod : $@convention(method) (@guaranteed private_proto_private_class) -> () {
|
|
bb0(%0 : $private_proto_private_class):
|
|
debug_value %0 : $private_proto_private_class
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %3 = class_method %1 : $private_proto_private_class, #private_proto_private_class.theMethod : (private_proto_private_class) -> () -> (), $@convention(method) (@guaranteed private_proto_private_class) -> (){{.*}} // user: %4
|
|
// CHECK: %4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_private_class) -> (){{.*}} // user: %6
|
|
// CHECK: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: private_proto_private_class_theMethod
|
|
sil private [transparent] [thunk] @private_proto_1_private_class_witness : $@convention(witness_method: private_proto_1) (@in_guaranteed private_proto_private_class) -> () {
|
|
bb0(%0 : $*private_proto_private_class):
|
|
%1 = load %0 : $*private_proto_private_class
|
|
strong_retain %1 : $private_proto_private_class
|
|
%3 = class_method %1 : $private_proto_private_class, #private_proto_private_class.theMethod : (private_proto_private_class) -> () -> (), $@convention(method) (@guaranteed private_proto_private_class) -> ()
|
|
%4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_private_class) -> ()
|
|
strong_release %1 : $private_proto_private_class
|
|
return %4 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %2 = witness_method $T, #private_proto_1.theMethod : {{.*}} : $@convention(witness_method: private_proto_1) <τ_0_0 where τ_0_0 : private_proto_1> (@in_guaranteed τ_0_0) -> (){{.*}} // user: %3
|
|
// CHECK: %3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_1) <τ_0_0 where τ_0_0 : private_proto_1> (@in_guaranteed τ_0_0) -> ()
|
|
// CHECK: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: private_proto_1_private_class_witness
|
|
sil private @call_through_private_proto_1 : $@convention(thin) <T where T : private_proto_1> (@in T) -> () {
|
|
bb0(%0 : $*T):
|
|
debug_value %0 : $*T, expr op_deref
|
|
%2 = witness_method $T, #private_proto_1.theMethod : $@convention(witness_method: private_proto_1) <τ_0_0 where τ_0_0 : private_proto_1> (@in_guaranteed τ_0_0) -> ()
|
|
%3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_1) <τ_0_0 where τ_0_0 : private_proto_1> (@in_guaranteed τ_0_0) -> ()
|
|
destroy_addr %0 : $*T
|
|
%5 = tuple ()
|
|
return %5 : $()
|
|
}
|
|
|
|
|
|
sil hidden @private_proto_internal_class_theMethod : $@convention(method) (@guaranteed private_proto_internal_class) -> () {
|
|
bb0(%0 : $private_proto_internal_class):
|
|
debug_value %0 : $private_proto_internal_class
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %3 = class_method %1 : $private_proto_internal_class, #private_proto_internal_class.theMethod : (private_proto_internal_class) -> () -> (), $@convention(method) (@guaranteed private_proto_internal_class) -> (){{.*}} // user: %4
|
|
// CHECK: %4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_internal_class) -> (){{.*}} // user: %6
|
|
// CHECK-NOWMO: Incomplete callee list? : Yes
|
|
// CHECK-WMO: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: private_proto_internal_class_theMethod
|
|
sil private [transparent] [thunk] @private_proto_2_internal_class_witness : $@convention(witness_method: private_proto_2) (@in_guaranteed private_proto_internal_class) -> () {
|
|
bb0(%0 : $*private_proto_internal_class):
|
|
%1 = load %0 : $*private_proto_internal_class
|
|
strong_retain %1 : $private_proto_internal_class
|
|
%3 = class_method %1 : $private_proto_internal_class, #private_proto_internal_class.theMethod : (private_proto_internal_class) -> () -> (), $@convention(method) (@guaranteed private_proto_internal_class) -> ()
|
|
%4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_internal_class) -> ()
|
|
strong_release %1 : $private_proto_internal_class
|
|
return %4 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %2 = witness_method $T, #private_proto_2.theMethod : {{.*}} : $@convention(witness_method: private_proto_2) <τ_0_0 where τ_0_0 : private_proto_2> (@in_guaranteed τ_0_0) -> (){{.*}} // user: %3
|
|
// CHECK: %3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_2) <τ_0_0 where τ_0_0 : private_proto_2> (@in_guaranteed τ_0_0) -> ()
|
|
// CHECK-WMO: Incomplete callee list? : No
|
|
// CHECK-NOWMO: Incomplete callee list? : Yes
|
|
// CHECK: Known callees:
|
|
// CHECK: private_proto_2_internal_class_witness
|
|
sil private @call_through_private_proto_2 : $@convention(thin) <T where T : private_proto_2> (@in T) -> () {
|
|
bb0(%0 : $*T):
|
|
debug_value %0 : $*T, expr op_deref
|
|
%2 = witness_method $T, #private_proto_2.theMethod : $@convention(witness_method: private_proto_2) <τ_0_0 where τ_0_0 : private_proto_2> (@in_guaranteed τ_0_0) -> ()
|
|
%3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_2) <τ_0_0 where τ_0_0 : private_proto_2> (@in_guaranteed τ_0_0) -> ()
|
|
destroy_addr %0 : $*T
|
|
%5 = tuple ()
|
|
return %5 : $()
|
|
}
|
|
|
|
|
|
sil @private_proto_public_class_theMethod : $@convention(method) (@guaranteed private_proto_public_class) -> () {
|
|
bb0(%0 : $private_proto_public_class):
|
|
debug_value %0 : $private_proto_public_class
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %3 = class_method %1 : $private_proto_public_class, #private_proto_public_class.theMethod : (private_proto_public_class) -> () -> (), $@convention(method) (@guaranteed private_proto_public_class) -> (){{.*}} // user: %4
|
|
// CHECK: %4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_public_class) -> (){{.*}} // user: %6
|
|
// CHECK: Incomplete callee list? : Yes
|
|
// CHECK: Known callees:
|
|
// CHECK: private_proto_public_class_theMethod
|
|
sil private [transparent] [thunk] @private_proto_3_public_class_witness : $@convention(witness_method: private_proto_3) (@in_guaranteed private_proto_public_class) -> () {
|
|
bb0(%0 : $*private_proto_public_class):
|
|
%1 = load %0 : $*private_proto_public_class
|
|
strong_retain %1 : $private_proto_public_class
|
|
%3 = class_method %1 : $private_proto_public_class, #private_proto_public_class.theMethod : (private_proto_public_class) -> () -> (), $@convention(method) (@guaranteed private_proto_public_class) -> ()
|
|
%4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_public_class) -> ()
|
|
strong_release %1 : $private_proto_public_class
|
|
return %4 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %2 = witness_method $T, #private_proto_3.theMethod : {{.*}} : $@convention(witness_method: private_proto_3) <τ_0_0 where τ_0_0 : private_proto_3> (@in_guaranteed τ_0_0) -> (){{.*}} // user: %3
|
|
// CHECK: %3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_3) <τ_0_0 where τ_0_0 : private_proto_3> (@in_guaranteed τ_0_0) -> ()
|
|
// CHECK: Incomplete callee list? : Yes
|
|
// CHECK: Known callees:
|
|
// CHECK: private_proto_3_public_class_witness
|
|
sil private @call_through_private_proto_3 : $@convention(thin) <T where T : private_proto_3> (@in T) -> () {
|
|
bb0(%0 : $*T):
|
|
debug_value %0 : $*T, expr op_deref
|
|
%2 = witness_method $T, #private_proto_3.theMethod : $@convention(witness_method: private_proto_3) <τ_0_0 where τ_0_0 : private_proto_3> (@in_guaranteed τ_0_0) -> ()
|
|
%3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_3) <τ_0_0 where τ_0_0 : private_proto_3> (@in_guaranteed τ_0_0) -> ()
|
|
destroy_addr %0 : $*T
|
|
%5 = tuple ()
|
|
return %5 : $()
|
|
}
|
|
|
|
|
|
sil private @private_proto_public_class_private_method_theMethod : $@convention(method) (@guaranteed private_proto_public_class_private_method) -> () {
|
|
bb0(%0 : $private_proto_public_class_private_method):
|
|
debug_value %0 : $private_proto_public_class_private_method
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %3 = class_method %1 : $private_proto_public_class_private_method, #private_proto_public_class_private_method.theMethod : (private_proto_public_class_private_method) -> () -> (), $@convention(method) (@guaranteed private_proto_public_class_private_method) -> (){{.*}} // user: %4
|
|
// CHECK: %4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_public_class_private_method) -> (){{.*}} // user: %6
|
|
// CHECK: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: private_proto_public_class_private_method_theMethod
|
|
sil private [transparent] [thunk] @private_proto_4_public_class_private_method_witness : $@convention(witness_method: private_proto_4) (@in_guaranteed private_proto_public_class_private_method) -> () {
|
|
bb0(%0 : $*private_proto_public_class_private_method):
|
|
%1 = load %0 : $*private_proto_public_class_private_method
|
|
strong_retain %1 : $private_proto_public_class_private_method
|
|
%3 = class_method %1 : $private_proto_public_class_private_method, #private_proto_public_class_private_method.theMethod : (private_proto_public_class_private_method) -> () -> (), $@convention(method) (@guaranteed private_proto_public_class_private_method) -> ()
|
|
%4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_public_class_private_method) -> ()
|
|
strong_release %1 : $private_proto_public_class_private_method
|
|
return %4 : $()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %2 = witness_method $T, #private_proto_4.theMethod : {{.*}} : $@convention(witness_method: private_proto_4) <τ_0_0 where τ_0_0 : private_proto_4> (@in_guaranteed τ_0_0) -> (){{.*}} // user: %3
|
|
// CHECK: %3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_4) <τ_0_0 where τ_0_0 : private_proto_4> (@in_guaranteed τ_0_0) -> ()
|
|
// CHECK: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: private_proto_4_public_class_private_method_witness
|
|
sil private @call_through_private_proto_4 : $@convention(thin) <T where T : private_proto_4> (@in T) -> () {
|
|
bb0(%0 : $*T):
|
|
debug_value %0 : $*T, expr op_deref
|
|
%2 = witness_method $T, #private_proto_4.theMethod : $@convention(witness_method: private_proto_4) <τ_0_0 where τ_0_0 : private_proto_4> (@in_guaranteed τ_0_0) -> ()
|
|
%3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_4) <τ_0_0 where τ_0_0 : private_proto_4> (@in_guaranteed τ_0_0) -> ()
|
|
destroy_addr %0 : $*T
|
|
%5 = tuple ()
|
|
return %5 : $()
|
|
}
|
|
|
|
|
|
sil_vtable private_proto_private_class {
|
|
#private_proto_private_class.theMethod: @private_proto_private_class_theMethod
|
|
}
|
|
|
|
sil_vtable private_proto_internal_class {
|
|
#private_proto_internal_class.theMethod: @private_proto_internal_class_theMethod
|
|
}
|
|
|
|
sil_vtable private_proto_public_class {
|
|
#private_proto_public_class.theMethod: @private_proto_public_class_theMethod
|
|
}
|
|
|
|
sil_vtable private_proto_public_class_private_method {
|
|
#private_proto_public_class_private_method.theMethod: @private_proto_public_class_private_method_theMethod
|
|
}
|
|
|
|
sil_witness_table private private_proto_private_class: private_proto_1 module witness {
|
|
method #private_proto_1.theMethod: @private_proto_1_private_class_witness
|
|
}
|
|
|
|
sil_witness_table private private_proto_internal_class: private_proto_2 module witness {
|
|
method #private_proto_2.theMethod: @private_proto_2_internal_class_witness
|
|
}
|
|
|
|
sil_witness_table private private_proto_public_class: private_proto_3 module witness {
|
|
method #private_proto_3.theMethod: @private_proto_3_public_class_witness
|
|
}
|
|
|
|
sil_witness_table private private_proto_public_class_private_method: private_proto_4 module witness {
|
|
method #private_proto_4.theMethod: @private_proto_4_public_class_private_method_witness
|
|
}
|
|
|
|
// Test initializer vs allocator
|
|
|
|
struct InitVal { }
|
|
|
|
class SomeItem {
|
|
required init(ivalreq: InitVal)
|
|
convenience init(ival: InitVal)
|
|
deinit
|
|
}
|
|
|
|
class SomeChildItem : SomeItem {
|
|
deinit
|
|
required init(ivalreq: InitVal)
|
|
}
|
|
|
|
sil @test_call_of_allocator_and_initializer : $@convention(thin) (@thick SomeItem.Type, InitVal) -> @owned SomeItem {
|
|
bb0(%0 : $@thick SomeItem.Type, %1: $InitVal):
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: %2 = class_method %0 : $@thick SomeItem.Type, #SomeItem.init!allocator : (SomeItem.Type) -> (InitVal) -> SomeItem, $@convention(method) (InitVal, @thick SomeItem.Type) -> @owned SomeItem
|
|
// CHECK: %3 = apply %2(%1, %0) : $@convention(method) (InitVal, @thick SomeItem.Type) -> @owned SomeItem
|
|
// CHECK-NOWMO: Incomplete callee list? : Yes
|
|
// CHECK-WMO: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: SomeChildItem_allocator
|
|
// CHECK: SomeItem_allocator
|
|
|
|
%2 = class_method %0 : $@thick SomeItem.Type, #SomeItem.init!allocator : (SomeItem.Type) -> (InitVal) -> SomeItem, $@convention(method) (InitVal, @thick SomeItem.Type) -> @owned SomeItem
|
|
%3 = apply %2(%1, %0) : $@convention(method) (InitVal, @thick SomeItem.Type) -> @owned SomeItem
|
|
|
|
return %3 : $SomeItem
|
|
}
|
|
|
|
sil @SomeItem_allocator : $@convention(method) (InitVal, @thick SomeItem.Type) -> @owned SomeItem
|
|
|
|
sil @SomeItem_initializer : $@convention(method) (InitVal, @owned SomeItem) -> @owned SomeItem
|
|
|
|
sil @SomeItem_destructor : $@convention(method) (@owned SomeItem) -> ()
|
|
|
|
sil @SomeChildItem_allocator : $@convention(method) (InitVal, @thick SomeChildItem.Type) -> @owned SomeChildItem
|
|
|
|
sil @SomeChildItem_initializer : $@convention(method) (InitVal, @owned SomeChildItem) -> @owned SomeChildItem
|
|
|
|
sil @SomeChildItem_destructor : $@convention(method) (@owned SomeChildItem) -> ()
|
|
|
|
sil_vtable SomeItem {
|
|
#SomeItem.init!allocator: @SomeItem_allocator
|
|
#SomeItem.init!initializer: @SomeItem_initializer
|
|
#SomeItem.deinit!deallocator: @SomeItem_destructor
|
|
}
|
|
|
|
sil_vtable SomeChildItem {
|
|
#SomeItem.init!allocator: @SomeChildItem_allocator [override]
|
|
#SomeItem.init!initializer: @SomeChildItem_initializer [override]
|
|
#SomeChildItem.deinit!deallocator: @SomeChildItem_destructor
|
|
}
|
|
|
|
public protocol PublicProtocol {
|
|
func foo()
|
|
}
|
|
|
|
struct SingleConformance : PublicProtocol {
|
|
func foo()
|
|
}
|
|
|
|
public func testit(p: PublicProtocol)
|
|
|
|
sil private [transparent] [thunk] @foo_impl : $@convention(witness_method: PublicProtocol) (@in_guaranteed SingleConformance) -> () {
|
|
bb0(%0 : $*SingleConformance):
|
|
%4 = tuple ()
|
|
return %4 : $()
|
|
}
|
|
|
|
// CHECK-LABEL: Function call site:
|
|
// CHECK: witness_method $@opened{{.*}} PublicProtocol
|
|
// CHECK: apply {{.*}} PublicProtocol
|
|
// CHECK-NOWMO: Incomplete callee list? : Yes
|
|
// CHECK-WMO: Incomplete callee list? : Yes
|
|
// CHECK: Known callees:
|
|
sil @call_foo : $@convention(thin) (@in PublicProtocol) -> () {
|
|
bb0(%0 : $*PublicProtocol):
|
|
%5 = open_existential_addr immutable_access %0 : $*PublicProtocol to $*@opened("2226A1AC-2B95-11E8-BDF4-D0817AD3F637", PublicProtocol) Self
|
|
%6 = witness_method $@opened("2226A1AC-2B95-11E8-BDF4-D0817AD3F637", PublicProtocol) Self, #PublicProtocol.foo : <Self where Self : PublicProtocol> (Self) -> () -> (), %5 : $*@opened("2226A1AC-2B95-11E8-BDF4-D0817AD3F637", PublicProtocol) Self : $@convention(witness_method: PublicProtocol) <τ_0_0 where τ_0_0 : PublicProtocol> (@in_guaranteed τ_0_0) -> ()
|
|
%7 = apply %6<@opened("2226A1AC-2B95-11E8-BDF4-D0817AD3F637", PublicProtocol) Self>(%5) : $@convention(witness_method: PublicProtocol) <τ_0_0 where τ_0_0 : PublicProtocol> (@in_guaranteed τ_0_0) -> ()
|
|
destroy_addr %0 : $*PublicProtocol
|
|
%10 = tuple ()
|
|
return %10 : $()
|
|
}
|
|
|
|
sil_witness_table hidden SingleConformance: PublicProtocol module nix {
|
|
method #PublicProtocol.foo: <Self where Self : PublicProtocol> (Self) -> () -> () : @foo_impl
|
|
}
|
|
|
|
sil @closureIntArg : $@convention(thin) (InitVal) -> ()
|
|
|
|
// CHECK-LABEL-LABEL: Function call site:
|
|
// CHECK: convert_escape_to_noescape
|
|
// CHECK: apply %{{.*}}() : $@noescape @callee_guaranteed () -> ()
|
|
// CHECK: Incomplete callee list? : No
|
|
// CHECK: Known callees:
|
|
// CHECK: closureIntArg
|
|
sil @call_noescape_closure : $@convention(thin) (InitVal) -> () {
|
|
entry(%0 : $InitVal):
|
|
%f = function_ref @closureIntArg : $@convention(thin) (InitVal) -> ()
|
|
%e = partial_apply [callee_guaranteed] %f(%0) : $@convention(thin) (InitVal) -> ()
|
|
%n = convert_escape_to_noescape %e : $@callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> ()
|
|
apply %n() : $@noescape @callee_guaranteed () -> ()
|
|
strong_release %e : $@callee_guaranteed () -> ()
|
|
%t = tuple ()
|
|
return %t : $()
|
|
}
|