2 clang -g -c odr-uniquing.cpp -o odr-uniquing/1.o
3 cp odr-uniquing/1.o odr-uniquing/2.o
4 The aim of these test is to check that all the 'type types' that
5 should be uniqued through the ODR really are.
7 The resulting object file is linked against itself using a fake
8 debug map. The end result is:
9 - with ODR uniquing: all types (expect for the union for now) in
10 the second CU should point back to the types of the first CU.
11 - without ODR uniquing: all types are re-emited in the second CU
14 // RUN: dsymutil -f -oso-prepend-path=%p/../Inputs/odr-uniquing -y %p/dummy-debug-map.map -o - | llvm-dwarfdump -v -debug-info - | FileCheck -check-prefixes=ODR,CHECK %s
15 // RUN: dsymutil -f -oso-prepend-path=%p/../Inputs/odr-uniquing -y %p/dummy-debug-map.map -no-odr -o - | llvm-dwarfdump -v -debug-info - | FileCheck -check-prefixes=NOODR,CHECK %s
17 // RUN: dsymutil --linker parallel -f -oso-prepend-path=%p/../Inputs/odr-uniquing -y %p/dummy-debug-map.map -no-odr -o - | llvm-dwarfdump -v -debug-info - | FileCheck -check-prefixes=NOODR,CHECK %s
19 // The first compile unit contains all the types:
20 // CHECK: TAG_compile_unit
22 // CHECK: AT_name{{.*}}"odr-uniquing.cpp"
28 // CHECK: 0x[[S:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
29 // CHECK-NEXT: DW_AT_name{{.*}}"S"
31 // CHECK: 0x[[NESTED:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
33 // CHECK: DW_AT_name{{.*}}"Nested"
40 // CHECK: DW_TAG_namespace
41 // CHECK-NEXT: DW_AT_name{{.*}}"N"
43 // CHECK: 0x[[NC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type
44 // CHECK-NEXT: DW_AT_name{{.*}}"C"
52 // CHECK: 0x[[U:[0-9a-f]*]]:{{.*}}DW_TAG_union_type
53 // CHECK-NEXT: DW_AT_name{{.*}}"U"
55 // CHECK: 0x[[UC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type
57 // CHECK: 0x[[US:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
62 // CHECK: 0x[[ALIASFORS:[0-9a-f]*]]:{{.*}}DW_TAG_typedef
63 // CHECK-NEXT: DW_AT_type{{.*}}[[S]]
64 // CHECK-NEXT: DW_AT_name{{.*}}"AliasForS"
70 // CHECK: DW_TAG_namespace
71 // CHECK-NOT: {{DW_AT_name|NULL|DW_TAG}}
72 // CHECK: 0x[[ANONC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type
73 // CHECK-NEXT: DW_AT_name{{.*}}"AnonC"
75 // This function is only here to hold objects that refer to the above types.
84 // The second CU contents depend on whether we disabled ODR uniquing or
87 // CHECK: TAG_compile_unit
89 // CHECK: AT_name{{.*}}"odr-uniquing.cpp"
91 // The union itself is not uniqued for now (for dsymutil-compatibility),
92 // but the types defined inside it should be.
93 // ODR: DW_TAG_union_type
94 // ODR-NEXT: DW_AT_name{{.*}}"U"
96 // ODR-NEXT: DW_AT_name{{.*}}"C"
98 // ODR: DW_AT_type{{.*}}[[UC]]
100 // ODR-NEXT: DW_AT_name{{.*}}"S"
102 // ODR: DW_AT_type{{.*}}[[US]]
104 // Check that the variables point to the right type
105 // ODR: DW_TAG_subprogram
107 // ODR: DW_AT_name{{.*}}"foo"
109 // ODR: DW_TAG_variable
111 // ODR: DW_AT_name{{.*}}"s"
113 // ODR: DW_AT_type{{.*}}[[ALIASFORS]]
114 // ODR: DW_AT_name{{.*}}"n"
116 // ODR: DW_AT_type{{.*}}[[NESTED]]
117 // ODR: DW_TAG_variable
119 // ODR: DW_AT_name{{.*}}"nc"
121 // ODR: DW_AT_type{{.*}}[[NC]]
122 // ODR: DW_TAG_variable
124 // ODR: DW_AT_name{{.*}}"ac"
126 // ODR: DW_AT_type{{.*}}[[ANONC]]
128 // With no ODR uniquing, we should get copies of all the types:
130 // This is "struct S"
131 // NOODR: 0x[[DUP_S:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
132 // NOODR-NEXT: DW_AT_name{{.*}}"S"
134 // NOODR: 0x[[DUP_NESTED:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
136 // NOODR: DW_AT_name{{.*}}"Nested"
138 // This is "class N::C"
139 // NOODR: DW_TAG_namespace
140 // NOODR-NEXT: DW_AT_name{{.*}}"N"
141 // NOODR: 0x[[DUP_NC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type
142 // NOODR-NEXT: DW_AT_name{{.*}}"C"
145 // NOODR: 0x[[DUP_U:[0-9a-f]*]]:{{.*}}DW_TAG_union_type
146 // NOODR-NEXT: DW_AT_name{{.*}}"U"
148 // NOODR: 0x[[DUP_UC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type
150 // NOODR: 0x[[DUP_US:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
153 // Check that the variables point to the right type
154 // NOODR: DW_TAG_subprogram
156 // NOODR: DW_AT_name{{.*}}"foo"
158 // NOODR: DW_TAG_variable
160 // NOODR: DW_AT_name{{.*}}"s"
162 // NOODR: DW_AT_type{{.*}}0x[[DUP_ALIASFORS:[0-9a-f]*]]
163 // NOODR: DW_TAG_variable
165 // NOODR: DW_AT_name{{.*}}"n"
167 // NOODR: DW_AT_type{{.*}}[[DUP_NESTED]]
168 // NOODR: DW_TAG_variable
170 // NOODR: DW_AT_name{{.*}}"nc"
172 // NOODR: DW_AT_type{{.*}}[[DUP_NC]]
173 // NOODR: DW_TAG_variable
175 // NOODR: DW_AT_name{{.*}}"ac"
177 // NOODR: DW_AT_type{{.*}}0x[[DUP_ANONC:[0-9a-f]*]]
179 // This is "AliasForS"
180 // NOODR: 0x[[DUP_ALIASFORS]]:{{.*}}DW_TAG_typedef
182 // NOODR: DW_AT_name{{.*}}"AliasForS"
184 // This is "(anonymous namespace)::AnonC"
185 // NOODR: DW_TAG_namespace
186 // NOODR-NOT: {{DW_AT_name|NULL|DW_TAG}}
187 // NOODR: 0x[[DUP_ANONC]]:{{.*}}DW_TAG_class_type
188 // NOODR-NEXT: DW_AT_name{{.*}}"AnonC"