1 ## This test checks debug info for the case when one compilation unit
2 ## contains a forward declaration of a type and another compilation unit
3 ## contains a definition for that type. The result should contain
4 ## the original definition and the declaration without modifications.
6 # RUN: yaml2obj %s -o %t.o
7 # RUN: llvm-dwarfutil %t.o - | llvm-dwarfdump -a - | FileCheck %s
12 ## template<int> class class2;
24 ## template<int> class class2 {
31 # CHECK: file format elf64-x86-64
32 # CHECK: .debug_info contents:
34 # CHECK: DW_TAG_compile_unit
35 # CHECK: DW_AT_name{{.*}}"CU1"
37 # CHECK: 0x[[CU1_CLASS1:[0-9a-f]*]]: DW_TAG_class_type{{.*[[:space:]].*}}DW_AT_name{{.*}}"class1"
38 # CHECK: DW_AT_declaration (true)
40 # CHECK: 0x[[CU1_CLASS2:[0-9a-f]*]]: DW_TAG_class_type{{.*[[:space:]].*}}DW_AT_name{{.*}}"class2"
41 # CHECK: DW_AT_declaration (true)
42 # CHECK: DW_TAG_template_type_parameter{{.*[[:space:]].*}}DW_AT_type{{.*}}0x00000000[[CU1_INT:[0-9a-f]*]] "int"
44 # CHECK: 0x[[CU1_INT]]: DW_TAG_base_type
45 # CHECK: DW_AT_name{{.*}}"int"
47 # CHECK: 0x[[CU1_PTR_CLASS1:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x00000000[[CU1_CLASS1]] "class1"
49 # CHECK: 0x[[CU1_PTR_CLASS2:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x00000000[[CU1_CLASS2]] "class2<int>"
51 # CHECK: DW_TAG_variable
52 # CHECK: DW_AT_name{{.*}}"var1"
53 # CHECK: DW_AT_type{{.*}}0x00000000[[CU1_PTR_CLASS1]] "class1 *"
54 # CHECK: DW_TAG_variable
55 # CHECK: DW_AT_name{{.*}}"var2"
56 # CHECK: DW_AT_type{{.*}}0x00000000[[CU1_PTR_CLASS2]] "class2<int> *"
58 # CHECK: DW_TAG_compile_unit
59 # CHECK: DW_AT_name{{.*}}"CU2"
61 # CHECK: 0x[[CU2_CLASS1:[0-9a-f]*]]: DW_TAG_class_type{{.*[[:space:]].*}}DW_AT_name{{.*}}"class1"
62 # CHECK: DW_TAG_member
63 # CHECK: DW_AT_type{{.*}}0x00000000[[CU2_CHAR:[0-9a-f]*]] "char"
64 # CHECK: DW_AT_name{{.*}}"member1"
66 # CHECK: DW_TAG_member
67 # CHECK: DW_AT_type{{.*}}0x00000000[[CU2_FLOAT:[0-9a-f]*]] "float"
68 # CHECK: DW_AT_name{{.*}}"member2"
70 # CHECK: 0x[[CU2_CLASS2:[0-9a-f]*]]: DW_TAG_class_type{{.*[[:space:]].*}}DW_AT_name{{.*}}"class2"
71 # CHECK: DW_TAG_template_type_parameter{{.*[[:space:]].*}}DW_AT_type{{.*}}0x00000000[[CU2_INT:[0-9a-f]*]] "int"
72 # CHECK: DW_TAG_member
73 # CHECK: DW_AT_type{{.*}}0x00000000[[CU2_CHAR]] "char"
74 # CHECK: DW_AT_name{{.*}}"member1"
76 # CHECK: 0x[[CU2_INT]]: DW_TAG_base_type
77 # CHECK: DW_AT_name{{.*}}"int"
79 # CHECK: 0x[[CU2_CHAR]]: DW_TAG_base_type
80 # CHECK: DW_AT_name{{.*}}"char"
82 # CHECK: 0x[[CU2_FLOAT]]: DW_TAG_base_type
83 # CHECK: DW_AT_name{{.*}}"float"
85 # CHECK: 0x[[CU2_PTR_CLASS1:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x00000000[[CU2_CLASS1]] "class1"
87 # CHECK: 0x[[CU2_PTR_CLASS2:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x00000000[[CU2_CLASS2]] "class2<int>"
89 # CHECK: DW_TAG_variable
90 # CHECK: DW_AT_name{{.*}}"var1"
91 # CHECK: DW_AT_type{{.*}}0x00000000[[CU2_PTR_CLASS1]] "class1 *"
92 # CHECK: DW_TAG_variable
93 # CHECK: DW_AT_name{{.*}}"var2"
94 # CHECK: DW_AT_type{{.*}}0x00000000[[CU2_PTR_CLASS2]] "class2<int> *"
105 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
110 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
116 - Tag: DW_TAG_compile_unit
117 Children: DW_CHILDREN_yes
119 - Attribute: DW_AT_producer
121 - Attribute: DW_AT_language
123 - Attribute: DW_AT_name
125 - Attribute: DW_AT_low_pc
127 - Attribute: DW_AT_high_pc
129 - Tag: DW_TAG_class_type
130 Children: DW_CHILDREN_yes
132 - Attribute: DW_AT_name
135 Children: DW_CHILDREN_no
137 - Attribute: DW_AT_type
138 Form: DW_FORM_ref_addr
139 - Attribute: DW_AT_name
141 - Tag: DW_TAG_class_type
142 Children: DW_CHILDREN_no
144 - Attribute: DW_AT_name
146 - Attribute: DW_AT_declaration
147 Form: DW_FORM_flag_present
148 - Tag: DW_TAG_class_type
149 Children: DW_CHILDREN_yes
151 - Attribute: DW_AT_name
153 - Attribute: DW_AT_declaration
154 Form: DW_FORM_flag_present
155 - Tag: DW_TAG_template_type_parameter
156 Children: DW_CHILDREN_no
158 - Attribute: DW_AT_type
159 Form: DW_FORM_ref_addr
160 - Tag: DW_TAG_base_type
161 Children: DW_CHILDREN_no
163 - Attribute: DW_AT_name
165 - Tag: DW_TAG_pointer_type
166 Children: DW_CHILDREN_no
168 - Attribute: DW_AT_type
169 Form: DW_FORM_ref_addr
170 - Tag: DW_TAG_variable
171 Children: DW_CHILDREN_no
173 - Attribute: DW_AT_name
175 - Attribute: DW_AT_const_value
177 - Attribute: DW_AT_type
178 Form: DW_FORM_ref_addr
180 - Tag: DW_TAG_compile_unit
181 Children: DW_CHILDREN_yes
183 - Attribute: DW_AT_producer
185 - Attribute: DW_AT_language
187 - Attribute: DW_AT_name
189 - Attribute: DW_AT_low_pc
191 - Attribute: DW_AT_high_pc
193 - Tag: DW_TAG_class_type
194 Children: DW_CHILDREN_yes
196 - Attribute: DW_AT_name
199 Children: DW_CHILDREN_no
201 - Attribute: DW_AT_type
202 Form: DW_FORM_ref_addr
203 - Attribute: DW_AT_name
205 - Tag: DW_TAG_class_type
206 Children: DW_CHILDREN_no
208 - Attribute: DW_AT_name
210 - Attribute: DW_AT_declaration
211 Form: DW_FORM_flag_present
212 - Tag: DW_TAG_class_type
213 Children: DW_CHILDREN_yes
215 - Attribute: DW_AT_name
217 - Attribute: DW_AT_declaration
218 Form: DW_FORM_flag_present
219 - Tag: DW_TAG_template_type_parameter
220 Children: DW_CHILDREN_no
222 - Attribute: DW_AT_type
223 Form: DW_FORM_ref_addr
224 - Tag: DW_TAG_base_type
225 Children: DW_CHILDREN_no
227 - Attribute: DW_AT_name
229 - Tag: DW_TAG_pointer_type
230 Children: DW_CHILDREN_no
232 - Attribute: DW_AT_type
233 Form: DW_FORM_ref_addr
234 - Tag: DW_TAG_variable
235 Children: DW_CHILDREN_no
237 - Attribute: DW_AT_name
239 - Attribute: DW_AT_const_value
241 - Attribute: DW_AT_type
242 Form: DW_FORM_ref_addr