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-prefix=ODR -check-prefix=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-prefix=NOODR -check-prefix=CHECK %s
17 // The first compile unit contains all the types:
18 // CHECK: TAG_compile_unit
20 // CHECK: AT_name{{.*}}"odr-uniquing.cpp"
26 // CHECK: 0x[[S:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
27 // CHECK-NEXT: DW_AT_name{{.*}}"S"
29 // CHECK: 0x[[NESTED:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
31 // CHECK: DW_AT_name{{.*}}"Nested"
38 // CHECK: DW_TAG_namespace
39 // CHECK-NEXT: DW_AT_name{{.*}}"N"
41 // CHECK: 0x[[NC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type
42 // CHECK-NEXT: DW_AT_name{{.*}}"C"
50 // CHECK: 0x[[U:[0-9a-f]*]]:{{.*}}DW_TAG_union_type
51 // CHECK-NEXT: DW_AT_name{{.*}}"U"
53 // CHECK: 0x[[UC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type
55 // CHECK: 0x[[US:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
60 // CHECK: 0x[[ALIASFORS:[0-9a-f]*]]:{{.*}}DW_TAG_typedef
61 // CHECK-NEXT: DW_AT_type{{.*}}[[S]]
62 // CHECK-NEXT: DW_AT_name{{.*}}"AliasForS"
68 // CHECK: DW_TAG_namespace
69 // CHECK-NOT: {{DW_AT_name|NULL|DW_TAG}}
70 // CHECK: 0x[[ANONC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type
71 // CHECK-NEXT: DW_AT_name{{.*}}"AnonC"
73 // This function is only here to hold objects that refer to the above types.
82 // The second CU contents depend on whether we disabled ODR uniquing or
85 // CHECK: TAG_compile_unit
87 // CHECK: AT_name{{.*}}"odr-uniquing.cpp"
89 // The union itself is not uniqued for now (for dsymutil-compatibility),
90 // but the types defined inside it should be.
91 // ODR: DW_TAG_union_type
92 // ODR-NEXT: DW_AT_name{{.*}}"U"
94 // ODR-NEXT: DW_AT_name{{.*}}"C"
96 // ODR: DW_AT_type{{.*}}[[UC]]
98 // ODR-NEXT: DW_AT_name{{.*}}"S"
100 // ODR: DW_AT_type{{.*}}[[US]]
102 // Check that the variables point to the right type
103 // ODR: DW_TAG_subprogram
105 // ODR: DW_AT_name{{.*}}"foo"
107 // ODR: DW_TAG_variable
109 // ODR: DW_AT_name{{.*}}"s"
111 // ODR: DW_AT_type{{.*}}[[ALIASFORS]]
112 // ODR: DW_AT_name{{.*}}"n"
114 // ODR: DW_AT_type{{.*}}[[NESTED]]
115 // ODR: DW_TAG_variable
117 // ODR: DW_AT_name{{.*}}"nc"
119 // ODR: DW_AT_type{{.*}}[[NC]]
120 // ODR: DW_TAG_variable
122 // ODR: DW_AT_name{{.*}}"ac"
124 // ODR: DW_AT_type{{.*}}[[ANONC]]
126 // With no ODR uniquing, we should get copies of all the types:
128 // This is "struct S"
129 // NOODR: 0x[[DUP_S:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
130 // NOODR-NEXT: DW_AT_name{{.*}}"S"
132 // NOODR: 0x[[DUP_NESTED:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
134 // NOODR: DW_AT_name{{.*}}"Nested"
136 // This is "class N::C"
137 // NOODR: DW_TAG_namespace
138 // NOODR-NEXT: DW_AT_name{{.*}}"N"
139 // NOODR: 0x[[DUP_NC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type
140 // NOODR-NEXT: DW_AT_name{{.*}}"C"
143 // NOODR: 0x[[DUP_U:[0-9a-f]*]]:{{.*}}DW_TAG_union_type
144 // NOODR-NEXT: DW_AT_name{{.*}}"U"
146 // NOODR: 0x[[DUP_UC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type
148 // NOODR: 0x[[DUP_US:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
151 // Check that the variables point to the right type
152 // NOODR: DW_TAG_subprogram
154 // NOODR: DW_AT_name{{.*}}"foo"
156 // NOODR: DW_TAG_variable
158 // NOODR: DW_AT_name{{.*}}"s"
160 // NOODR: DW_AT_type{{.*}}0x[[DUP_ALIASFORS:[0-9a-f]*]]
161 // NOODR: DW_TAG_variable
163 // NOODR: DW_AT_name{{.*}}"n"
165 // NOODR: DW_AT_type{{.*}}[[DUP_NESTED]]
166 // NOODR: DW_TAG_variable
168 // NOODR: DW_AT_name{{.*}}"nc"
170 // NOODR: DW_AT_type{{.*}}[[DUP_NC]]
171 // NOODR: DW_TAG_variable
173 // NOODR: DW_AT_name{{.*}}"ac"
175 // NOODR: DW_AT_type{{.*}}0x[[DUP_ANONC:[0-9a-f]*]]
177 // This is "AliasForS"
178 // NOODR: 0x[[DUP_ALIASFORS]]:{{.*}}DW_TAG_typedef
180 // NOODR: DW_AT_name{{.*}}"AliasForS"
182 // This is "(anonymous namespace)::AnonC"
183 // NOODR: DW_TAG_namespace
184 // NOODR-NOT: {{DW_AT_name|NULL|DW_TAG}}
185 // NOODR: 0x[[DUP_ANONC]]:{{.*}}DW_TAG_class_type
186 // NOODR-NEXT: DW_AT_name{{.*}}"AnonC"