[Frontend] Remove unused includes (NFC) (#116927)
[llvm-project.git] / llvm / test / tools / llvm-dwarfutil / ELF / X86 / gc-class.test
blob92797e972597e365954763c7381584c640d32b40
1 ## This test checks debug info for the case when one compilation unit
2 ## contains a definition of a type and another compilation unit
3 ## contains a definition of the same type. When --garbage-collection
4 ## is enabled the result should contain the original definition in CU1
5 ## and the definition from CU2 should have been removed.
7 # RUN: yaml2obj %s -o %t.o
9 ## Check --odr-deduplication.
10 # RUN: llvm-dwarfutil %t.o %t1
11 # RUN: llvm-dwarfdump -a %t1 | FileCheck %s --check-prefixes=CHECK,CHECK-ODR
13 ## Check --odr alias.
14 # RUN: llvm-dwarfutil --odr %t.o %t2
15 # RUN: cmp %t1 %t2
17 ## Check --no-odr alias.
18 # RUN: llvm-dwarfutil --no-odr %t.o %t3
19 # RUN: llvm-dwarfdump -a %t3 | FileCheck %s --check-prefixes=CHECK,CHECK-NOODR
21 ## Check --no-odr-deduplication wins if last.
22 # RUN: llvm-dwarfutil --odr-deduplication --no-odr-deduplication %t.o %t4
23 # RUN: cmp %t3 %t4
25 ## Check --odr-deduplication wins if last.
26 # RUN: llvm-dwarfutil --no-odr-deduplication --odr-deduplication %t.o %t6
27 # RUN: cmp %t1 %t6
29 ## CU1:
31 ## class class1 {
32 ##   char member1;
33 ##   float member2;
34 ## };
36 ## class1 *var1;
38 ## CU2:
40 ## class class1 {
41 ##   char member1;
42 ##   float member2;
43 ## };
45 ## class1 *var1;
47 # CHECK: file format elf64-x86-64
48 # CHECK: .debug_info contents:
50 # CHECK: DW_TAG_compile_unit
51 # CHECK: DW_AT_name{{.*}}"CU1"
53 # CHECK: 0x[[CU1_CLASS1:[0-9a-f]*]]: DW_TAG_class_type{{.*[[:space:]].*}}DW_AT_name{{.*}}"class1"
54 # CHECK: DW_TAG_member
55 # CHECK-ODR: DW_AT_type{{.*}}0x00000000[[CU1_CHAR:[0-9a-f]*]] "char"
56 # CHECK-NOODR: DW_AT_type{{.*}}0x[[CU1_CHAR:[0-9a-f]*]] "char"
57 # CHECK: DW_AT_name{{.*}}"member1"
59 # CHECK: DW_TAG_member
60 # CHECK-ODR: DW_AT_type{{.*}}0x00000000[[CU1_FLOAT:[0-9a-f]*]] "float"
61 # CHECK-NOODR: DW_AT_type{{.*}}0x[[CU1_FLOAT:[0-9a-f]*]] "float"
62 # CHECK: DW_AT_name{{.*}}"member2"
64 # CHECK: 0x[[CU1_INT:[0-9a-f]*]]: DW_TAG_base_type
65 # CHECK: DW_AT_name{{.*}}"int"
67 # CHECK: 0x[[CU1_CHAR]]: DW_TAG_base_type
68 # CHECK: DW_AT_name{{.*}}"char"
70 # CHECK: 0x[[CU1_FLOAT]]: DW_TAG_base_type
71 # CHECK: DW_AT_name{{.*}}"float"
73 # CHECK-ODR: 0x[[CU1_PTR_CLASS1:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x00000000[[CU1_CLASS1]] "class1"
74 # CHECK-NOODR: 0x[[CU1_PTR_CLASS1:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x[[CU1_CLASS1]] "class1"
76 # CHECK: DW_TAG_variable
77 # CHECK: DW_AT_name{{.*}}"var1"
78 # CHECK-ODR: DW_AT_type{{.*}}0x00000000[[CU1_PTR_CLASS1]] "class1 *"
79 # CHECK-NOODR: DW_AT_type{{.*}}0x[[CU1_PTR_CLASS1]] "class1 *"
81 # CHECK: DW_TAG_compile_unit
82 # CHECK: DW_AT_name{{.*}}"CU2"
84 # CHECK-ODR-NOT: DW_TAG_class_type
85 # CHECK-ODR-NOT: "class1"
87 # CHECK-ODR: 0x[[CU2_PTR_CLASS1:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x00000000[[CU1_CLASS1]] "class1"
89 # CHECK-ODR: DW_TAG_variable
90 # CHECK-ODR: DW_AT_name{{.*}}"var1"
91 # CHECK-ODR: DW_AT_type{{.*}}0x00000000[[CU2_PTR_CLASS1]] "class1 *"
94 # CHECK-NOODR: 0x[[CU2_CLASS1:[0-9a-f]*]]: DW_TAG_class_type{{.*[[:space:]].*}}DW_AT_name{{.*}}"class1"
95 # CHECK-NOODR: DW_TAG_member
96 # CHECK-NOODR: DW_AT_type{{.*}}0x[[CU2_CHAR:[0-9a-f]*]] "char"
97 # CHECK-NOODR: DW_AT_name{{.*}}"member1"
99 # CHECK-NOODR: DW_TAG_member
100 # CHECK-NOODR: DW_AT_type{{.*}}0x[[CU2_FLOAT:[0-9a-f]*]] "float"
101 # CHECK-NOODR: DW_AT_name{{.*}}"member2"
103 # CHECK-NOODR: 0x[[CU2_INT:[0-9a-f]*]]: DW_TAG_base_type
104 # CHECK-NOODR: DW_AT_name{{.*}}"int"
106 # CHECK-NOODR: 0x[[CU2_CHAR]]: DW_TAG_base_type
107 # CHECK-NOODR: DW_AT_name{{.*}}"char"
109 # CHECK-NOODR: 0x[[CU2_FLOAT]]: DW_TAG_base_type
110 # CHECK-NOODR: DW_AT_name{{.*}}"float"
112 # CHECK-NOODR: 0x[[CU2_PTR_CLASS1:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x[[CU2_CLASS1]] "class1"
114 # CHECK-NOODR: DW_TAG_variable
115 # CHECK-NOODR: DW_AT_name{{.*}}"var1"
116 # CHECK-NOODR: DW_AT_type{{.*}}0x[[CU2_PTR_CLASS1]] "class1 *"
118 --- !ELF
119 FileHeader:
120   Class:    ELFCLASS64
121   Data:     ELFDATA2LSB
122   Type:     ET_REL
123   Machine:  EM_X86_64
124 Sections:
125   - Name:            .text
126     Type:            SHT_PROGBITS
127     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
128     Address:         0x1000
129     Size:            0x1b
130   - Name:            .text2
131     Type:            SHT_PROGBITS
132     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
133     Address:         0x2000
134     Size:            0x1b
135 DWARF:
136   debug_abbrev:
137     - Table:
138       - Tag:      DW_TAG_compile_unit
139         Children: DW_CHILDREN_yes
140         Attributes:
141           - Attribute: DW_AT_producer
142             Form:      DW_FORM_string
143           - Attribute: DW_AT_language
144             Form:      DW_FORM_data2
145           - Attribute: DW_AT_name
146             Form:      DW_FORM_string
147           - Attribute: DW_AT_low_pc
148             Form:      DW_FORM_addr
149           - Attribute: DW_AT_high_pc
150             Form:      DW_FORM_data8
151       - Tag:      DW_TAG_class_type
152         Children: DW_CHILDREN_yes
153         Attributes:
154           - Attribute: DW_AT_name
155             Form:      DW_FORM_string
156       - Tag:      DW_TAG_member
157         Children: DW_CHILDREN_no
158         Attributes:
159           - Attribute: DW_AT_type
160             Form:      DW_FORM_ref4
161           - Attribute: DW_AT_name
162             Form:      DW_FORM_string
163       - Tag:      DW_TAG_class_type
164         Children: DW_CHILDREN_no
165         Attributes:
166           - Attribute: DW_AT_name
167             Form:      DW_FORM_string
168           - Attribute: DW_AT_declaration
169             Form:      DW_FORM_flag_present
170       - Tag:      DW_TAG_class_type
171         Children: DW_CHILDREN_yes
172         Attributes:
173           - Attribute: DW_AT_name
174             Form:      DW_FORM_string
175           - Attribute: DW_AT_declaration
176             Form:      DW_FORM_flag_present
177       - Tag:      DW_TAG_template_type_parameter
178         Children: DW_CHILDREN_no
179         Attributes:
180           - Attribute: DW_AT_type
181             Form:      DW_FORM_ref4
182       - Tag:      DW_TAG_base_type
183         Children: DW_CHILDREN_no
184         Attributes:
185           - Attribute: DW_AT_name
186             Form:      DW_FORM_string
187       - Tag:      DW_TAG_pointer_type
188         Children: DW_CHILDREN_no
189         Attributes:
190           - Attribute: DW_AT_type
191             Form:      DW_FORM_ref4
192       - Tag:      DW_TAG_variable
193         Children: DW_CHILDREN_no
194         Attributes:
195           - Attribute: DW_AT_name
196             Form:      DW_FORM_string
197           - Attribute: DW_AT_const_value
198             Form:      DW_FORM_data4
199           - Attribute: DW_AT_type
200             Form:      DW_FORM_ref4
201     - Table:
202       - Tag:      DW_TAG_compile_unit
203         Children: DW_CHILDREN_yes
204         Attributes:
205           - Attribute: DW_AT_producer
206             Form:      DW_FORM_string
207           - Attribute: DW_AT_language
208             Form:      DW_FORM_data2
209           - Attribute: DW_AT_name
210             Form:      DW_FORM_string
211           - Attribute: DW_AT_low_pc
212             Form:      DW_FORM_addr
213           - Attribute: DW_AT_high_pc
214             Form:      DW_FORM_data8
215       - Tag:      DW_TAG_class_type
216         Children: DW_CHILDREN_yes
217         Attributes:
218           - Attribute: DW_AT_name
219             Form:      DW_FORM_string
220       - Tag:      DW_TAG_member
221         Children: DW_CHILDREN_no
222         Attributes:
223           - Attribute: DW_AT_type
224             Form:      DW_FORM_ref4
225           - Attribute: DW_AT_name
226             Form:      DW_FORM_string
227       - Tag:      DW_TAG_class_type
228         Children: DW_CHILDREN_no
229         Attributes:
230           - Attribute: DW_AT_name
231             Form:      DW_FORM_string
232           - Attribute: DW_AT_declaration
233             Form:      DW_FORM_flag_present
234       - Tag:      DW_TAG_class_type
235         Children: DW_CHILDREN_yes
236         Attributes:
237           - Attribute: DW_AT_name
238             Form:      DW_FORM_string
239           - Attribute: DW_AT_declaration
240             Form:      DW_FORM_flag_present
241       - Tag:      DW_TAG_template_type_parameter
242         Children: DW_CHILDREN_no
243         Attributes:
244           - Attribute: DW_AT_type
245             Form:      DW_FORM_ref4
246       - Tag:      DW_TAG_base_type
247         Children: DW_CHILDREN_no
248         Attributes:
249           - Attribute: DW_AT_name
250             Form:      DW_FORM_string
251       - Tag:      DW_TAG_pointer_type
252         Children: DW_CHILDREN_no
253         Attributes:
254           - Attribute: DW_AT_type
255             Form:      DW_FORM_ref4
256       - Tag:      DW_TAG_variable
257         Children: DW_CHILDREN_no
258         Attributes:
259           - Attribute: DW_AT_name
260             Form:      DW_FORM_string
261           - Attribute: DW_AT_const_value
262             Form:      DW_FORM_data4
263           - Attribute: DW_AT_type
264             Form:      DW_FORM_ref4
265   debug_info:
266     - Version: 4
267       Entries:
268         - AbbrCode: 1
269           Values:
270             - CStr: by_hand
271             - Value:  0x04
272             - CStr: CU1
273             - Value:  0x1000
274             - Value:  0x1b
275         - AbbrCode: 2
276           Values:
277             - CStr: class1
278         - AbbrCode: 3
279           Values:
280             - Value:  0x00000052
281             - CStr: member1
282         - AbbrCode: 3
283           Values:
284             - Value:  0x00000058
285             - CStr: member2
286         - AbbrCode: 0
287         - AbbrCode: 7
288           Values:
289             - CStr: int
290         - AbbrCode: 7
291           Values:
292             - CStr: char
293         - AbbrCode: 7
294           Values:
295             - CStr: float
296         - AbbrCode: 8
297           Values:
298             - Value:  0x0000002a
299         - AbbrCode: 9
300           Values:
301             - CStr: var1
302             - Value:  0x00000000
303             - Value:  0x0000005f
304         - AbbrCode: 0
305     - Version: 4
306       Entries:
307         - AbbrCode: 1
308           Values:
309             - CStr: by_hand
310             - Value:  0x04
311             - CStr: CU2
312             - Value:  0x2000
313             - Value:  0x1b
314         - AbbrCode: 2
315           Values:
316             - CStr: class1
317         - AbbrCode: 3
318           Values:
319             - Value:  0x00000052
320             - CStr: member1
321         - AbbrCode: 3
322           Values:
323             - Value:  0x00000058
324             - CStr: member2
325         - AbbrCode: 0
326         - AbbrCode: 7
327           Values:
328             - CStr: int
329         - AbbrCode: 7
330           Values:
331             - CStr: char
332         - AbbrCode: 7
333           Values:
334             - CStr: float
335         - AbbrCode: 8
336           Values:
337             - Value:  0x0000002a
338         - AbbrCode: 9
339           Values:
340             - CStr: var1
341             - Value:  0x00000000
342             - Value:  0x0000005f
343         - AbbrCode: 0