blob: 7c22be1da18d78de9de202bb2e539fad09b200f4 [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 Blaikied89b99d2013-08-22 15:23:05 +000055struct H {};
56struct I : virtual H {};
57struct J : I {};
58J j;
59
David Blaikie357aafb2013-02-01 19:09:49 +000060struct A {
Devang Patelcaa23f02010-08-12 00:02:44 +000061 int one;
David Blaikie357aafb2013-02-01 19:09:49 +000062 static const int HdrSize = 52;
Devang Patelcaa23f02010-08-12 00:02:44 +000063 int two;
64 A() {
65 int x = 1;
66 }
67};
David Blaikie831c9922012-12-13 22:29:06 +000068
David Blaikie6943dea2013-08-20 01:28:15 +000069void f1() {
70 D x;
71 x.func();
72 E y;
73 int i = F::i;
74 F::inner z;
75}
David Blaikie831c9922012-12-13 22:29:06 +000076
David Blaikie357aafb2013-02-01 19:09:49 +000077int main(int argc, char **argv) {
David Blaikied37bbc32012-11-02 20:49:01 +000078 B b;
David Blaikie6943dea2013-08-20 01:28:15 +000079 G::inner c_i;
David Blaikie357aafb2013-02-01 19:09:49 +000080 if (argc) {
81 A a;
82 }
83 return 0;
Devang Patelcaa23f02010-08-12 00:02:44 +000084}
David Blaikie357aafb2013-02-01 19:09:49 +000085
NAKAMURA Takumi2209f972013-02-03 12:52:54 +000086// RUN: %clang -target x86_64-unknown_unknown -emit-llvm -g -S %s -o - | FileCheck %s
87// RUN: %clang -target i686-cygwin -emit-llvm -g -S %s -o - | FileCheck %s
88// RUN: %clang -target armv7l-unknown-linux-gnueabihf -emit-llvm -g -S %s -o - | FileCheck %s
89
90// CHECK: invoke {{.+}} @_ZN1BD1Ev(%class.B* %b)
NAKAMURA Takumia7c84e62013-02-01 22:53:19 +000091// CHECK-NEXT: unwind label %{{.+}}, !dbg ![[EXCEPTLOC:.*]]
92// CHECK: store i32 0, i32* %{{.+}}, !dbg ![[RETLOC:.*]]
David Blaikie357aafb2013-02-01 19:09:49 +000093// CHECK: DW_TAG_structure_type ] [foo]
94// CHECK: DW_TAG_class_type ] [bar]
95// CHECK: DW_TAG_union_type ] [baz]
David Blaikie3b1cc9b2013-09-06 06:45:04 +000096// CHECK: DW_TAG_class_type ] [B] {{.*}} [def]
David Blaikie357aafb2013-02-01 19:09:49 +000097// CHECK: metadata !"_vptr$B", {{.*}}, i32 64, metadata !{{.*}}} ; [ DW_TAG_member ]
David Blaikie6943dea2013-08-20 01:28:15 +000098
Manman Ren85793592013-09-06 18:46:30 +000099// CHECK: [[C:![0-9]*]] = {{.*}} metadata [[C_MEM:![0-9]*]], i32 0, metadata !"_ZTS1C", null, metadata !"_ZTS1C"} ; [ DW_TAG_structure_type ] [C] {{.*}} [def]
David Blaikie6943dea2013-08-20 01:28:15 +0000100// CHECK: [[C_MEM]] = metadata !{metadata [[C_VPTR:![0-9]*]], metadata [[C_S:![0-9]*]], metadata [[C_DTOR:![0-9]*]]}
101// CHECK: [[C_VPTR]] = {{.*}} ; [ DW_TAG_member ] [_vptr$C] {{.*}} [artificial]
102// CHECK: [[C_S]] = {{.*}} ; [ DW_TAG_member ] [s] {{.*}} [static] [from int]
103// CHECK: [[C_DTOR]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [~C]
104
David Blaikie3275dc42013-12-20 23:19:47 +0000105// CHECK: null, i32 0, null, null, metadata !"_ZTS1D"} ; [ DW_TAG_structure_type ] [D] {{.*}} [decl]
Manman Rene0064d82013-08-29 23:19:58 +0000106// CHECK: null, i32 0, null, null, metadata !"_ZTS1E"} ; [ DW_TAG_structure_type ] [E] {{.*}} [decl]
David Blaikie3275dc42013-12-20 23:19:47 +0000107// CHECK: [[F:![0-9]*]] = {{.*}} null, i32 0, null, null, metadata !"_ZTS1F"} ; [ DW_TAG_structure_type ] [F] {{.*}} [decl]
Manman Renf801f802013-08-29 20:48:48 +0000108
David Blaikie3b1cc9b2013-09-06 06:45:04 +0000109// CHECK: null, i32 0, null, null, metadata !"_ZTS1G"} ; [ DW_TAG_structure_type ] [G] {{.*}} [decl]
Manman Rene0064d82013-08-29 23:19:58 +0000110// CHECK: metadata [[G_INNER_MEM:![0-9]*]], i32 0, null, null, metadata !"_ZTSN1G5innerE"} ; [ DW_TAG_structure_type ] [inner] [line 50, {{.*}} [def]
Manman Renf801f802013-08-29 20:48:48 +0000111// CHECK: [[G_INNER_MEM]] = metadata !{metadata [[G_INNER_I:![0-9]*]]}
112// CHECK: [[G_INNER_I]] = {{.*}} ; [ DW_TAG_member ] [j] {{.*}} [from int]
Manman Ren035c4b02013-08-29 18:51:51 +0000113
Manman Rene0064d82013-08-29 23:19:58 +0000114// CHECK: ; [ DW_TAG_structure_type ] [A]
115// CHECK: HdrSize
Manman Ren07ab3c32013-10-08 22:56:54 +0000116// CHECK: ; [ DW_TAG_structure_type ] [I] {{.*}} [def]
David Blaikie3275dc42013-12-20 23:19:47 +0000117//
118// CHECK: metadata !"_ZTS1D", {{.*}}, metadata [[D_FUNC_DECL:![0-9]*]], metadata {{![0-9]*}}, i32 {{[0-9]*}}} ; [ DW_TAG_subprogram ] {{.*}} [def] [func]
119// CHECK: [[D_FUNC_DECL]] = {{.*}}, metadata !"_ZTS1D", {{.*}}, i32 0, metadata {{![0-9]*}}, i32 {{[0-9]*}}} ; [ DW_TAG_subprogram ] {{.*}} [func]
Manman Rene0064d82013-08-29 23:19:58 +0000120
David Blaikie3275dc42013-12-20 23:19:47 +0000121// CHECK: [[F_I_DEF:![0-9]*]] = {{.*}}, metadata [[F_I:![0-9]*]]} ; [ DW_TAG_variable ] [i]
122
123// CHECK: [[F_I]] = {{.*}}, metadata !"_ZTS1F", {{.*}} ; [ DW_TAG_member ] [i]
Manman Rene0064d82013-08-29 23:19:58 +0000124
David Blaikied89b99d2013-08-22 15:23:05 +0000125// CHECK: ![[EXCEPTLOC]] = metadata !{i32 84,
126// CHECK: ![[RETLOC]] = metadata !{i32 83,