blob: 76cc1e3e27c2148d351d9af9b9f06d03f6b9734d [file] [log] [blame]
David Blaikie9417b052012-11-02 20:49:01 +00001struct foo;
David Blaikie0a0f93c2013-02-01 19:09:49 +00002void func(foo *f) {
David Blaikie9417b052012-11-02 20:49:01 +00003}
4class bar;
David Blaikie0a0f93c2013-02-01 19:09:49 +00005void func(bar *f) {
David Blaikie9417b052012-11-02 20:49:01 +00006}
7union baz;
David Blaikie0a0f93c2013-02-01 19:09:49 +00008void func(baz *f) {
David Blaikie9417b052012-11-02 20:49:01 +00009}
NAKAMURA Takumi95f36362013-02-03 12:52:54 +000010
David Blaikie0a0f93c2013-02-01 19:09:49 +000011class B {
David Blaikiec9a91772012-12-13 22:29:06 +000012public:
13 virtual ~B();
David Blaikiec9a91772012-12-13 22:29:06 +000014};
David Blaikie152701b2013-08-16 20:40:29 +000015
16B::~B() {
17}
18
19struct C {
20 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
David Blaikie0a0f93c2013-02-01 19:09:49 +000041struct A {
Devang Pateldabc3e92010-08-12 00:02:44 +000042 int one;
David Blaikie0a0f93c2013-02-01 19:09:49 +000043 static const int HdrSize = 52;
Devang Pateldabc3e92010-08-12 00:02:44 +000044 int two;
45 A() {
46 int x = 1;
47 }
48};
David Blaikiec9a91772012-12-13 22:29:06 +000049
David Blaikie152701b2013-08-16 20:40:29 +000050void f1() {
51 D x;
52 x.func();
53 E y;
54}
David Blaikiec9a91772012-12-13 22:29:06 +000055
David Blaikie0a0f93c2013-02-01 19:09:49 +000056int main(int argc, char **argv) {
David Blaikie9417b052012-11-02 20:49:01 +000057 B b;
David Blaikie0a0f93c2013-02-01 19:09:49 +000058 if (argc) {
59 A a;
60 }
61 return 0;
Devang Pateldabc3e92010-08-12 00:02:44 +000062}
David Blaikie0a0f93c2013-02-01 19:09:49 +000063
NAKAMURA Takumi95f36362013-02-03 12:52:54 +000064// RUN: %clang -target x86_64-unknown_unknown -emit-llvm -g -S %s -o - | FileCheck %s
65// RUN: %clang -target i686-cygwin -emit-llvm -g -S %s -o - | FileCheck %s
66// RUN: %clang -target armv7l-unknown-linux-gnueabihf -emit-llvm -g -S %s -o - | FileCheck %s
67
68// CHECK: invoke {{.+}} @_ZN1BD1Ev(%class.B* %b)
NAKAMURA Takumi288c7552013-02-01 22:53:19 +000069// CHECK-NEXT: unwind label %{{.+}}, !dbg ![[EXCEPTLOC:.*]]
70// CHECK: store i32 0, i32* %{{.+}}, !dbg ![[RETLOC:.*]]
David Blaikie0a0f93c2013-02-01 19:09:49 +000071// CHECK: DW_TAG_structure_type ] [foo]
72// CHECK: DW_TAG_class_type ] [bar]
73// CHECK: DW_TAG_union_type ] [baz]
David Blaikie0a0f93c2013-02-01 19:09:49 +000074// CHECK: DW_TAG_class_type ] [B]
75// CHECK: metadata !"_vptr$B", {{.*}}, i32 64, metadata !{{.*}}} ; [ DW_TAG_member ]
David Blaikie152701b2013-08-16 20:40:29 +000076
77// CHECK: [[C:![0-9]*]] = {{.*}} metadata [[C_MEM:![0-9]*]], i32 0, metadata [[C]], null} ; [ DW_TAG_structure_type ] [C] {{.*}} [def]
78// CHECK: [[C_MEM]] = metadata !{metadata [[C_VPTR:![0-9]*]], metadata [[C_S:![0-9]*]], metadata [[C_DTOR:![0-9]*]]}
79// CHECK: [[C_VPTR]] = {{.*}} ; [ DW_TAG_member ] [_vptr$C] {{.*}} [artificial]
80// CHECK: [[C_S]] = {{.*}} ; [ DW_TAG_member ] [s] {{.*}} [static] [from int]
81// CHECK: [[C_DTOR]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [~C]
82
83// CHECK: ; [ DW_TAG_structure_type ] [A]
84// CHECK: HdrSize
85// CHECK: metadata [[D_MEM:![0-9]*]], i32 0, null} ; [ DW_TAG_structure_type ] [D] {{.*}} [decl]
86// CHECK: [[D_MEM]] = metadata !{metadata [[D_FUNC:![0-9]*]]}
87// CHECK: [[D_FUNC]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [func]
88// CHECK: null, i32 0, null} ; [ DW_TAG_structure_type ] [E] {{.*}} [decl]
89// CHECK: ![[EXCEPTLOC]] = metadata !{i32 62,
90// CHECK: ![[RETLOC]] = metadata !{i32 61,