[flang][cuda] Do not register global constants (#118582)
[llvm-project.git] / llvm / test / tools / llvm-dwarfutil / ELF / X86 / odr-fwd-declaration.test
blob224d668870b44d9dcc767536423b0795c298f9f7
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
9 ## CU1:
11 ## class class1;
12 ## template<int> class class2;
14 ## class1 *var1;
15 ## class2<int> *var2;
17 ## CU2:
19 ## class class1 {
20 ##   char member1;
21 ##   float member2;
22 ## };
24 ## template<int> class class2 {
25 ##   char member1;
26 ## };
28 ## class1 *var1;
29 ## class2<int> *var2;
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> *"
96 --- !ELF
97 FileHeader:
98   Class:    ELFCLASS64
99   Data:     ELFDATA2LSB
100   Type:     ET_REL
101   Machine:  EM_X86_64
102 Sections:
103   - Name:            .text
104     Type:            SHT_PROGBITS
105     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
106     Address:         0x1000
107     Size:            0x1b
108   - Name:            .text2
109     Type:            SHT_PROGBITS
110     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
111     Address:         0x2000
112     Size:            0x1b
113 DWARF:
114   debug_abbrev:
115     - Table:
116       - Tag:      DW_TAG_compile_unit
117         Children: DW_CHILDREN_yes
118         Attributes:
119           - Attribute: DW_AT_producer
120             Form:      DW_FORM_string
121           - Attribute: DW_AT_language
122             Form:      DW_FORM_data2
123           - Attribute: DW_AT_name
124             Form:      DW_FORM_string
125           - Attribute: DW_AT_low_pc
126             Form:      DW_FORM_addr
127           - Attribute: DW_AT_high_pc
128             Form:      DW_FORM_data8
129       - Tag:      DW_TAG_class_type
130         Children: DW_CHILDREN_yes
131         Attributes:
132           - Attribute: DW_AT_name
133             Form:      DW_FORM_string
134       - Tag:      DW_TAG_member
135         Children: DW_CHILDREN_no
136         Attributes:
137           - Attribute: DW_AT_type
138             Form:      DW_FORM_ref_addr
139           - Attribute: DW_AT_name
140             Form:      DW_FORM_string
141       - Tag:      DW_TAG_class_type
142         Children: DW_CHILDREN_no
143         Attributes:
144           - Attribute: DW_AT_name
145             Form:      DW_FORM_string
146           - Attribute: DW_AT_declaration
147             Form:      DW_FORM_flag_present
148       - Tag:      DW_TAG_class_type
149         Children: DW_CHILDREN_yes
150         Attributes:
151           - Attribute: DW_AT_name
152             Form:      DW_FORM_string
153           - Attribute: DW_AT_declaration
154             Form:      DW_FORM_flag_present
155       - Tag:      DW_TAG_template_type_parameter
156         Children: DW_CHILDREN_no
157         Attributes:
158           - Attribute: DW_AT_type
159             Form:      DW_FORM_ref_addr
160       - Tag:      DW_TAG_base_type
161         Children: DW_CHILDREN_no
162         Attributes:
163           - Attribute: DW_AT_name
164             Form:      DW_FORM_string
165       - Tag:      DW_TAG_pointer_type
166         Children: DW_CHILDREN_no
167         Attributes:
168           - Attribute: DW_AT_type
169             Form:      DW_FORM_ref_addr
170       - Tag:      DW_TAG_variable
171         Children: DW_CHILDREN_no
172         Attributes:
173           - Attribute: DW_AT_name
174             Form:      DW_FORM_string
175           - Attribute: DW_AT_const_value
176             Form:      DW_FORM_data4
177           - Attribute: DW_AT_type
178             Form:      DW_FORM_ref_addr
179     - Table:
180       - Tag:      DW_TAG_compile_unit
181         Children: DW_CHILDREN_yes
182         Attributes:
183           - Attribute: DW_AT_producer
184             Form:      DW_FORM_string
185           - Attribute: DW_AT_language
186             Form:      DW_FORM_data2
187           - Attribute: DW_AT_name
188             Form:      DW_FORM_string
189           - Attribute: DW_AT_low_pc
190             Form:      DW_FORM_addr
191           - Attribute: DW_AT_high_pc
192             Form:      DW_FORM_data8
193       - Tag:      DW_TAG_class_type
194         Children: DW_CHILDREN_yes
195         Attributes:
196           - Attribute: DW_AT_name
197             Form:      DW_FORM_string
198       - Tag:      DW_TAG_member
199         Children: DW_CHILDREN_no
200         Attributes:
201           - Attribute: DW_AT_type
202             Form:      DW_FORM_ref_addr
203           - Attribute: DW_AT_name
204             Form:      DW_FORM_string
205       - Tag:      DW_TAG_class_type
206         Children: DW_CHILDREN_no
207         Attributes:
208           - Attribute: DW_AT_name
209             Form:      DW_FORM_string
210           - Attribute: DW_AT_declaration
211             Form:      DW_FORM_flag_present
212       - Tag:      DW_TAG_class_type
213         Children: DW_CHILDREN_yes
214         Attributes:
215           - Attribute: DW_AT_name
216             Form:      DW_FORM_string
217           - Attribute: DW_AT_declaration
218             Form:      DW_FORM_flag_present
219       - Tag:      DW_TAG_template_type_parameter
220         Children: DW_CHILDREN_no
221         Attributes:
222           - Attribute: DW_AT_type
223             Form:      DW_FORM_ref_addr
224       - Tag:      DW_TAG_base_type
225         Children: DW_CHILDREN_no
226         Attributes:
227           - Attribute: DW_AT_name
228             Form:      DW_FORM_string
229       - Tag:      DW_TAG_pointer_type
230         Children: DW_CHILDREN_no
231         Attributes:
232           - Attribute: DW_AT_type
233             Form:      DW_FORM_ref_addr
234       - Tag:      DW_TAG_variable
235         Children: DW_CHILDREN_no
236         Attributes:
237           - Attribute: DW_AT_name
238             Form:      DW_FORM_string
239           - Attribute: DW_AT_const_value
240             Form:      DW_FORM_data4
241           - Attribute: DW_AT_type
242             Form:      DW_FORM_ref_addr
243   debug_info:
244     - Version: 4
245       Entries:
246         - AbbrCode: 1
247           Values:
248             - CStr: by_hand
249             - Value:  0x04
250             - CStr: CU1
251             - Value:  0x1000
252             - Value:  0x1b
253         - AbbrCode: 4
254           Values:
255             - CStr: class1
256         - AbbrCode: 5
257           Values:
258             - CStr: class2
259         - AbbrCode: 6
260           Values:
261             - Value:  0x00000040
262         - AbbrCode: 0
263         - AbbrCode: 7
264           Values:
265             - CStr: int
266         - AbbrCode: 8
267           Values:
268             - Value:  0x0000002a
269         - AbbrCode: 8
270           Values:
271             - Value:  0x00000032
272         - AbbrCode: 9
273           Values:
274             - CStr: var1
275             - Value:  0x00000000
276             - Value:  0x00000045
277         - AbbrCode: 9
278           Values:
279             - CStr: var2
280             - Value:  0x00000000
281             - Value:  0x0000004a
282         - AbbrCode: 0
283     - Version: 4
284       Entries:
285         - AbbrCode: 1
286           Values:
287             - CStr: by_hand
288             - Value:  0x04
289             - CStr: CU2
290             - Value:  0x2000
291             - Value:  0x1b
292         - AbbrCode: 2
293           Values:
294             - CStr: class1
295         - AbbrCode: 3
296           Values:
297             - Value:  0x000000d9
298             - CStr: member1
299         - AbbrCode: 3
300           Values:
301             - Value:  0x000000df
302             - CStr: member2
303         - AbbrCode: 0
304         - AbbrCode: 2
305           Values:
306             - CStr: class2
307         - AbbrCode: 6
308           Values:
309             - Value:  0x000000d4
310         - AbbrCode: 3
311           Values:
312             - Value:  0x000000d9
313             - CStr: member1
314         - AbbrCode: 0
315         - AbbrCode: 7
316           Values:
317             - CStr: int
318         - AbbrCode: 7
319           Values:
320             - CStr: char
321         - AbbrCode: 7
322           Values:
323             - CStr: float
324         - AbbrCode: 8
325           Values:
326             - Value:  0x00000096
327         - AbbrCode: 8
328           Values:
329             - Value:  0x000000b9
330         - AbbrCode: 9
331           Values:
332             - CStr: var1
333             - Value:  0x00000000
334             - Value:  0x000000e6
335         - AbbrCode: 9
336           Values:
337             - CStr: var2
338             - Value:  0x00000000
339             - Value:  0x000000eb
340         - AbbrCode: 0