Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / debug-info-class.cpp
blobef84b91b67821a90486ac1dfd8fb37b574654d2f
1 struct foo;
2 void func(foo *f) {
4 class bar;
5 void func(bar *f) {
7 union baz;
8 void func(baz *f) {
11 class B {
12 public:
13 virtual ~B();
16 B::~B() { extern void mayThrow(); mayThrow();
19 struct C {
20 static int s;
21 virtual ~C();
24 C::~C() {
27 struct D {
28 D();
29 virtual ~D();
30 void func() {
34 struct E {
35 E();
36 virtual ~E();
37 virtual void func() {
41 struct F {
42 struct inner {
44 static const int i = 2;
45 virtual ~F();
48 struct G {
49 virtual void func();
50 struct inner {
51 int j;
55 struct H {};
56 struct I : virtual H {};
57 struct J : I {};
58 J j;
60 struct K {
61 virtual void func() {
65 struct A {
66 int one;
67 static const int HdrSize = 52;
68 int two;
69 A() {
70 int x = 1;
74 namespace {
75 struct L {
76 void func() {
81 void f1() {
82 D x;
83 x.func();
84 E y;
85 int i = F::i;
86 F::inner z;
87 K k;
88 k.func();
89 L l;
90 l.func();
93 int main(int argc, char **argv) {
94 B b;
95 G::inner c_i;
96 if (argc) {
97 A a;
99 return 0;
102 // RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited -fexceptions -std=c++98 %s -o - | FileCheck -check-prefix=CHECK98 -check-prefix=CHECK %s
103 // RUN: %clang_cc1 -triple i686-cygwin -emit-llvm -debug-info-kind=limited -fexceptions -std=c++98 %s -o - | FileCheck -check-prefix=CHECK98 -check-prefix=CHECK %s
104 // RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -debug-info-kind=limited -fexceptions -std=c++98 %s -o - | FileCheck -check-prefix=CHECK98 -check-prefix=CHECK %s
105 // RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited -fexceptions -std=c++11 %s -o - | FileCheck -check-prefix=CHECK11 -check-prefix=CHECK %s
106 // RUN: %clang_cc1 -triple i686-cygwin -emit-llvm -debug-info-kind=limited -fexceptions -std=c++11 %s -o - | FileCheck -check-prefix=CHECK11 -check-prefix=CHECK %s
107 // RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -debug-info-kind=limited -fexceptions -std=c++11 %s -o - | FileCheck -check-prefix=CHECK11 -check-prefix=CHECK %s
109 // CHECK98: invoke {{.+}} @_ZN1BD1Ev(ptr {{[^,]*}} %b)
110 // CHECK98-NEXT: unwind label %{{.+}}, !dbg ![[EXCEPTLOC:.*]]
111 // CHECK11: call {{.+}} @_ZN1BD1Ev(ptr {{[^,]*}} %b){{.*}}, !dbg ![[EXCEPTLOC:.*]]
113 // CHECK: store i32 0, ptr %{{.+}}, !dbg ![[RETLOC:.*]]
115 // CHECK: [[F:![0-9]*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "F"
116 // CHECK-SAME: DIFlagFwdDecl
117 // CHECK-NOT: identifier:
118 // CHECK-SAME: ){{$}}
119 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "I"
120 // CHECK-NOT: DIFlagFwdDecl
121 // CHECK-SAME: ){{$}}
123 // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
124 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo"
125 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "bar"
126 // CHECK: !DICompositeType(tag: DW_TAG_union_type, name: "baz"
127 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "B"
128 // CHECK-NOT: DIFlagFwdDecl
129 // CHECK-SAME: ){{$}}
130 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "_vptr$B",
131 // CHECK-SAME: DIFlagArtificial
133 // CHECK: [[C:![0-9]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C",
134 // CHECK-NOT: DIFlagFwdDecl
135 // CHECK-SAME: elements: [[C_MEM:![0-9]*]]
136 // CHECK-SAME: vtableHolder: [[C]]
137 // CHECK-NOT: identifier:
138 // CHECK-SAME: ){{$}}
139 // CHECK: [[C_MEM]] = !{[[C_VPTR:![0-9]*]], [[C_S:![0-9]*]], [[C_DTOR:![0-9]*]]}
140 // CHECK: [[C_VPTR]] = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$C"
141 // CHECK-SAME: DIFlagArtificial
142 // CHECK: [[C_S]] = !DIDerivedType(tag: DW_TAG_member, name: "s"
143 // CHECK-SAME: baseType: ![[INT]]
144 // CHECK-SAME: DIFlagStaticMember
145 // CHECK: [[C_DTOR]] = !DISubprogram(name: "~C"
147 // CHECK: [[D:![0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "D"
148 // CHECK-SAME: size:
149 // CHECK-SAME: DIFlagFwdDecl
150 // CHECK-NOT: identifier:
151 // CHECK-SAME: ){{$}}
153 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "E"
154 // CHECK-SAME: DIFlagFwdDecl
155 // CHECK-NOT: identifier:
156 // CHECK-SAME: ){{$}}
158 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "K"
159 // CHECK-SAME: identifier: "_ZTS1K"
160 // CHECK-SAME: ){{$}}
162 // CHECK: [[L:![0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "L"
163 // CHECK-SAME: ){{$}}
164 // CHECK: [[L_FUNC_DECL:![0-9]*]] = !DISubprogram(name: "func",{{.*}} scope: [[L]]
165 // CHECK-SAME: DISPFlagLocalToUnit
167 // CHECK: !DISubprogram(name: "func",{{.*}} scope: [[D]]
168 // CHECK-SAME: DISPFlagDefinition
169 // CHECK-SAME: declaration: [[D_FUNC_DECL:![0-9]*]]
170 // CHECK: [[D_FUNC_DECL]] = !DISubprogram(name: "func",{{.*}} scope: [[D]]
172 // CHECK: !DISubprogram(name: "func",{{.*}} scope: [[L]]
173 // CHECK-SAME: DISPFlagLocalToUnit | DISPFlagDefinition
174 // CHECK-SAME: declaration: [[L_FUNC_DECL]]
176 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "inner",{{.*}} line: 50
177 // CHECK-NOT: DIFlagFwdDecl
178 // CHECK-SAME: elements: [[G_INNER_MEM:![0-9]*]]
179 // CHECK-SAME: identifier: "_ZTSN1G5innerE"
181 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "G"
182 // CHECK-SAME: DIFlagFwdDecl
183 // CHECK-NOT: identifier:
184 // CHECK-SAME: ){{$}}
185 // CHECK: [[G_INNER_MEM]] = !{[[G_INNER_I:![0-9]*]]}
186 // CHECK: [[G_INNER_I]] = !DIDerivedType(tag: DW_TAG_member, name: "j"
187 // CHECK-SAME: baseType: ![[INT]]
189 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A"
190 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "HdrSize"
192 // CHECK: ![[EXCEPTLOC]] = !DILocation(line: 100,
193 // CHECK: ![[RETLOC]] = !DILocation(line: 99,