mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This simplifies the code generation path for existential methods by allowing it to shared more code with the generic case, (It'll be even simpler when Sema opens the existentials for SILGen...) turning protocol_method lookups into open_existential + witness_method sequences. In this patch, we handle normal generic method lookups, but property accesses still go through protocol_method. Swift SVN r22437
23 lines
751 B
Swift
23 lines
751 B
Swift
// RUN: %swift -target x86_64-apple-macosx10.9 %s -emit-ir -g -o - | FileCheck %s
|
|
protocol AProtocol {
|
|
func print()
|
|
}
|
|
|
|
class AClass : AProtocol {
|
|
var x : Int
|
|
init() { x = 0xDEADBEEF }
|
|
func print() { println("x = \(x)")}
|
|
}
|
|
// CHECK: define hidden void @_TF17ProtocolContainer3foo
|
|
// CHECK-NEXT: entry:
|
|
// CHECK-NEXT: %[[X:.*]] = alloca %P17ProtocolContainer9AProtocol_, align 8
|
|
// CHECK: call void @llvm.dbg.declare(metadata !{%P17ProtocolContainer9AProtocol_* %[[X]]}, metadata ![[XMD:.*]])
|
|
// CHECK-NOT: variable ] [x]
|
|
// CHECK: ![[XMD]] = {{.*}}[ DW_TAG_arg_variable ] [x] [line [[@LINE+2]]]
|
|
// CHECK-NOT: variable ] [x]
|
|
func foo (var x : AProtocol) {
|
|
x.print() // Set breakpoint here
|
|
}
|
|
var aProtocol : AProtocol = AClass()
|
|
foo(aProtocol)
|