mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This replaces the '[volatile]' flag. Now, class_method and super_method are only used for vtable dispatch. The witness_method instruction is still overloaded for use with both ObjC protocol requirements and Swift protocol requirements; the next step is to make it only mean the latter, also using objc_method for ObjC protocol calls.
40 lines
1.4 KiB
Plaintext
40 lines
1.4 KiB
Plaintext
// RUN: %target-swift-frontend %s -emit-silgen -disable-objc-attr-requires-foundation-module | %FileCheck %s
|
|
|
|
// rdar://15763213
|
|
// Make sure that we can parse SILDeclRef to an overloaded member.
|
|
|
|
import Swift
|
|
import Builtin
|
|
|
|
struct A {
|
|
init()
|
|
}
|
|
|
|
@objc class X {
|
|
init(a: A)
|
|
init(a1: A, a2: A)
|
|
}
|
|
|
|
// CHECK-LABEL: sil @_TFCSo1XcfMS_FT1aV11peer_method1A_S_
|
|
sil @_TFCSo1XcfMS_FT1aV11peer_method1A_S_ : $@convention(method) (A, @owned X) -> @owned X {
|
|
bb0(%0 : $A, %1 : $X):
|
|
%2 = alloc_box $<τ_0_0> { var τ_0_0 } <X>
|
|
%2a = project_box %2 : $<τ_0_0> { var τ_0_0 } <X>, 0
|
|
%3 = alloc_box $<τ_0_0> { var τ_0_0 } <A>
|
|
%3a = project_box %3 : $<τ_0_0> { var τ_0_0 } <A>, 0
|
|
store %0 to [trivial] %3a : $*A
|
|
%5 = mark_uninitialized [delegatingself] %1 : $X
|
|
store %5 to [init] %2a : $*X
|
|
%7 = load [copy] %2a : $*X
|
|
// CHECK: objc_method %{{[0-9]+}} : $X, #X.init!initializer.1.foreign : (X.Type) -> (A, A) -> X, $@convention(objc_method) (A, A, @owned X) -> @owned X
|
|
%9 = objc_method %7 : $X, #X.init!initializer.1.foreign : (X.Type) -> (A, A) -> X, $@convention(objc_method) (A, A, @owned X) -> @owned X
|
|
%10 = load [trivial] %3a : $*A
|
|
%11 = load [trivial] %3a : $*A
|
|
%12 = apply %9(%10, %11, %7) : $@convention(objc_method) (A, A, @owned X) -> @owned X
|
|
assign %12 to %2a : $*X
|
|
destroy_value %3 : $<τ_0_0> { var τ_0_0 } <A>
|
|
%15 = load [copy] %2a : $*X
|
|
destroy_value %2 : $<τ_0_0> { var τ_0_0 } <X>
|
|
return %15 : $X
|
|
}
|