blob: e63eeb5eae5316551ebb854ee790dc681370b5a1 [file] [log] [blame]
David Blaikied37bbc32012-11-02 20:49:01 +00001struct foo;
David Blaikie357aafb2013-02-01 19:09:49 +00002void func(foo *f) {
David Blaikied37bbc32012-11-02 20:49:01 +00003}
4class bar;
David Blaikie357aafb2013-02-01 19:09:49 +00005void func(bar *f) {
David Blaikied37bbc32012-11-02 20:49:01 +00006}
7union baz;
David Blaikie357aafb2013-02-01 19:09:49 +00008void func(baz *f) {
David Blaikied37bbc32012-11-02 20:49:01 +00009}
NAKAMURA Takumi2209f972013-02-03 12:52:54 +000010
David Blaikie357aafb2013-02-01 19:09:49 +000011class B {
David Blaikie831c9922012-12-13 22:29:06 +000012public:
13 virtual ~B();
David Blaikie831c9922012-12-13 22:29:06 +000014};
David Blaikieadfbf992013-08-18 16:55:33 +000015
David Blaikie6943dea2013-08-20 01:28:15 +000016B::~B() {
17}
18
David Blaikieadfbf992013-08-18 16:55:33 +000019struct C {
David Blaikie6943dea2013-08-20 01:28:15 +000020 static int s;
21 virtual ~C();
22};
23
24C::~C() {
25}
26
27struct D {
28 D();
29 virtual ~D();
30 void func() {
31 }
32};
33
34struct E {
35 E();
36 virtual ~E();
37 virtual void func() {
38 }
39};
40
41struct F {
42 struct inner {
43 };
44 static const int i = 2;
45 virtual ~F();
46};
47
48struct G {
David Blaikieadfbf992013-08-18 16:55:33 +000049 virtual void func();
50 struct inner {
51 int j;
52 };
53};
54
David Blaikie357aafb2013-02-01 19:09:49 +000055struct A {
Devang Patelcaa23f02010-08-12 00:02:44 +000056 int one;
David Blaikie357aafb2013-02-01 19:09:49 +000057 static const int HdrSize = 52;
Devang Patelcaa23f02010-08-12 00:02:44 +000058 int two;
59 A() {
60 int x = 1;
61 }
62};
David Blaikie831c9922012-12-13 22:29:06 +000063
David Blaikie6943dea2013-08-20 01:28:15 +000064void f1() {
65 D x;
66 x.func();
67 E y;
68 int i = F::i;
69 F::inner z;
70}
David Blaikie831c9922012-12-13 22:29:06 +000071
David Blaikie357aafb2013-02-01 19:09:49 +000072int main(int argc, char **argv) {
David Blaikied37bbc32012-11-02 20:49:01 +000073 B b;
David Blaikie6943dea2013-08-20 01:28:15 +000074 G::inner c_i;
David Blaikie357aafb2013-02-01 19:09:49 +000075 if (argc) {
76 A a;
77 }
78 return 0;
Devang Patelcaa23f02010-08-12 00:02:44 +000079}
David Blaikie357aafb2013-02-01 19:09:49 +000080
NAKAMURA Takumi2209f972013-02-03 12:52:54 +000081// RUN: %clang -target x86_64-unknown_unknown -emit-llvm -g -S %s -o - | FileCheck %s
82// RUN: %clang -target i686-cygwin -emit-llvm -g -S %s -o - | FileCheck %s
83// RUN: %clang -target armv7l-unknown-linux-gnueabihf -emit-llvm -g -S %s -o - | FileCheck %s
84
85// CHECK: invoke {{.+}} @_ZN1BD1Ev(%class.B* %b)
NAKAMURA Takumia7c84e62013-02-01 22:53:19 +000086// CHECK-NEXT: unwind label %{{.+}}, !dbg ![[EXCEPTLOC:.*]]
87// CHECK: store i32 0, i32* %{{.+}}, !dbg ![[RETLOC:.*]]
David Blaikie357aafb2013-02-01 19:09:49 +000088// CHECK: DW_TAG_structure_type ] [foo]
89// CHECK: DW_TAG_class_type ] [bar]
90// CHECK: DW_TAG_union_type ] [baz]
David Blaikie357aafb2013-02-01 19:09:49 +000091// CHECK: DW_TAG_class_type ] [B]
92// CHECK: metadata !"_vptr$B", {{.*}}, i32 64, metadata !{{.*}}} ; [ DW_TAG_member ]
David Blaikie6943dea2013-08-20 01:28:15 +000093
94// CHECK: [[C:![0-9]*]] = {{.*}} metadata [[C_MEM:![0-9]*]], i32 0, metadata [[C]], null} ; [ DW_TAG_structure_type ] [C] {{.*}} [def]
95// CHECK: [[C_MEM]] = metadata !{metadata [[C_VPTR:![0-9]*]], metadata [[C_S:![0-9]*]], metadata [[C_DTOR:![0-9]*]]}
96// CHECK: [[C_VPTR]] = {{.*}} ; [ DW_TAG_member ] [_vptr$C] {{.*}} [artificial]
97// CHECK: [[C_S]] = {{.*}} ; [ DW_TAG_member ] [s] {{.*}} [static] [from int]
98// CHECK: [[C_DTOR]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [~C]
99
100// CHECK: ; [ DW_TAG_structure_type ] [A]
101// CHECK: HdrSize
102// CHECK: metadata [[D_MEM:![0-9]*]], i32 0, null} ; [ DW_TAG_structure_type ] [D] {{.*}} [decl]
103// CHECK: [[D_MEM]] = metadata !{metadata [[D_FUNC:![0-9]*]]}
104// CHECK: [[D_FUNC]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [func]
105
106// CHECK: [[F_I_DEF:![0-9]*]] = {{.*}}, metadata [[F_I:![0-9]*]]} ; [ DW_TAG_variable ] [i]
107// CHECK: [[F_I]] = {{.*}} ; [ DW_TAG_member ] [i]
108// CHECK: [[F:![0-9]*]] = {{.*}} metadata [[F_MEM:![0-9]*]], i32 0, null, null} ; [ DW_TAG_structure_type ] [F] {{.*}} [def]
109// CHECK: [[F_MEM]] = metadata !{metadata [[F_I]]}
110
111// CHECK: null, i32 0, null} ; [ DW_TAG_structure_type ] [E] {{.*}} [decl]
112
113// CHECK: metadata [[G_INNER_MEM:![0-9]*]], i32 0, null, null} ; [ DW_TAG_structure_type ] [inner] [line 50, {{.*}} [def]
David Blaikieadfbf992013-08-18 16:55:33 +0000114// Context chains (in Clang -flimit-debug-info and in GCC generally) contain
115// definitions without members (& without a vbase 'containing type'):
David Blaikie6943dea2013-08-20 01:28:15 +0000116// CHECK: null, i32 0, null, null} ; [ DW_TAG_structure_type ] [G] {{.*}} [def]
117// CHECK: [[G_INNER_MEM]] = metadata !{metadata [[G_INNER_I:![0-9]*]]}
118// CHECK: [[G_INNER_I]] = {{.*}} ; [ DW_TAG_member ] [j] {{.*}} [from int]
119
120// CHECK: ![[EXCEPTLOC]] = metadata !{i32 79,
121// CHECK: ![[RETLOC]] = metadata !{i32 78,