Files
swift-mirror/test/DebugInfo/ProtocolContainer.swift
Joe Groff a9f0cc0ae7 SILGen: Open existentials when invoking their methods.
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
2014-10-01 20:15:58 +00:00

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)