1 struct foo;
2 void func(foo *f) {
3 }
4 class bar;
5 void func(bar *f) {
6 }
7 union baz;
8 void func(baz *f) {
9 }
10 
11 class B {
12 public:
13   virtual ~B();
14 };
15 
16 B::~B() {
17 }
18 
19 struct C {
20   static int s;
21   virtual ~C();
22 };
23 
24 C::~C() {
25 }
26 
27 struct D {
28   D();
29   virtual ~D();
30   void func() {
31   }
32 };
33 
34 struct E {
35   E();
36   virtual ~E();
37   virtual void func() {
38   }
39 };
40 
41 struct F {
42   struct inner {
43   };
44   static const int i = 2;
45   virtual ~F();
46 };
47 
48 struct G {
49   virtual void func();
50   struct inner {
51     int j;
52   };
53 };
54 
55 struct H {};
56 struct I : virtual H {};
57 struct J : I {};
58 J j;
59 
60 struct A {
61   int one;
62   static const int HdrSize = 52;
63   int two;
64   A() {
65     int x = 1;
66   }
67 };
68 
69 void f1() {
70   D x;
71   x.func();
72   E y;
73   int i = F::i;
74   F::inner z;
75 }
76 
77 int main(int argc, char **argv) {
78   B b;
79   G::inner c_i;
80   if (argc) {
81     A a;
82   }
83   return 0;
84 }
85 
86 // RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited -fexceptions %s -o - | FileCheck %s
87 // RUN: %clang_cc1 -triple i686-cygwin -emit-llvm -debug-info-kind=limited -fexceptions %s -o - | FileCheck %s
88 // RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -debug-info-kind=limited -fexceptions %s -o - | FileCheck %s
89 
90 // CHECK: invoke {{.+}} @_ZN1BD1Ev(%class.B* %b)
91 // CHECK-NEXT: unwind label %{{.+}}, !dbg ![[EXCEPTLOC:.*]]
92 // CHECK: store i32 0, i32* %{{.+}}, !dbg ![[RETLOC:.*]]
93 
94 // CHECK: [[F:![0-9]*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "F"
95 // CHECK-SAME:                             DIFlagFwdDecl
96 // CHECK-SAME:                             identifier: "_ZTS1F"
97 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "I"
98 // CHECK-NOT:              DIFlagFwdDecl
99 // CHECK-SAME:             ){{$}}
100 
101 // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
102 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo"
103 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "bar"
104 // CHECK: !DICompositeType(tag: DW_TAG_union_type, name: "baz"
105 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "B"
106 // CHECK-NOT:              DIFlagFwdDecl
107 // CHECK-SAME:             ){{$}}
108 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "_vptr$B",
109 // CHECK-SAME:           DIFlagArtificial
110 
111 // CHECK: [[C:![0-9]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C",
112 // CHECK-NOT:                              DIFlagFwdDecl
113 // CHECK-SAME:                             elements: [[C_MEM:![0-9]*]]
114 // CHECK-SAME:                             vtableHolder: [[C]]
115 // CHECK-SAME:                             identifier: "_ZTS1C"
116 // CHECK: [[C_MEM]] = !{[[C_VPTR:![0-9]*]], [[C_S:![0-9]*]], [[C_DTOR:![0-9]*]]}
117 // CHECK: [[C_VPTR]] = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$C"
118 // CHECK-SAME:                        DIFlagArtificial
119 // CHECK: [[C_S]] = !DIDerivedType(tag: DW_TAG_member, name: "s"
120 // CHECK-SAME:                     baseType: ![[INT]]
121 // CHECK-SAME:                     DIFlagStaticMember
122 // CHECK: [[C_DTOR]] = !DISubprogram(name: "~C"
123 
124 // CHECK: [[D:![0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "D"
125 // CHECK-SAME:             DIFlagFwdDecl
126 // CHECK-SAME:             identifier: "_ZTS1D"
127 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "E"
128 // CHECK-SAME:             DIFlagFwdDecl
129 // CHECK-SAME:             identifier: "_ZTS1E"
130 
131 // CHECK: !DISubprogram(name: "func",{{.*}} scope: [[D]]
132 // CHECK-SAME:          isDefinition: true
133 // CHECK-SAME:          declaration: [[D_FUNC_DECL:![0-9]*]]
134 // CHECK: [[D_FUNC_DECL]] = !DISubprogram(name: "func",{{.*}} scope: [[D]]
135 // CHECK-SAME:                            isDefinition: false
136 
137 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "inner",{{.*}} line: 50
138 // CHECK-NOT: DIFlagFwdDecl
139 // CHECK-SAME: elements: [[G_INNER_MEM:![0-9]*]]
140 // CHECK-SAME: identifier: "_ZTSN1G5innerE"
141 
142 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "G"
143 // CHECK-SAME:             DIFlagFwdDecl
144 // CHECK-SAME:             identifier: "_ZTS1G"
145 // CHECK: [[G_INNER_MEM]] = !{[[G_INNER_I:![0-9]*]]}
146 // CHECK: [[G_INNER_I]] = !DIDerivedType(tag: DW_TAG_member, name: "j"
147 // CHECK-SAME:                           baseType: ![[INT]]
148 
149 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A"
150 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "HdrSize"
151 //
152 // CHECK: ![[EXCEPTLOC]] = !DILocation(line: 84,
153 // CHECK: ![[RETLOC]] = !DILocation(line: 83,
154