forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProtocolContainer.swift
27 lines (24 loc) · 1019 Bytes
/
ProtocolContainer.swift
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
// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
func markUsed<T>(t: T) {}
protocol AProtocol {
func print()
}
class AClass : AProtocol {
var x: UInt32
init() { x = 0xDEADBEEF }
func print() { markUsed("x = \(x)")}
}
// CHECK: define hidden void @_TF17ProtocolContainer3foo
// CHECK-NEXT: entry:
// CHECK: [[XADDR:[%].*]] = alloca %P17ProtocolContainer9AProtocol_*, align {{(4|8)}}
// CHECK: %.metadata1 = alloca %swift.type*, align {{(4|8)}}
// CHECK: store %P17ProtocolContainer9AProtocol_* %0, %P17ProtocolContainer9AProtocol_** [[XADDR]], align {{(4|8)}}
// CHECK: call void @llvm.dbg.declare(metadata %P17ProtocolContainer9AProtocol_** [[XADDR]], metadata ![[XMD:.*]], metadata !{{[0-9]+}})
// CHECK-NOT: !DILocalVariable({{.*}} name: "x"
// CHECK: ![[XMD]] = !DILocalVariable(name: "x", arg: 1,{{.*}}line: [[@LINE+2]]
// CHECK-NOT: !DILocalVariable({{.*}} name: "x"
func foo (x : AProtocol) {
x.print() // Set breakpoint here
}
var aProtocol : AProtocol = AClass()
foo(aProtocol)