llvm.org GIT mirror llvm / 449f036
DWARF Type Hashing: Include reference and rvalue reference type in the declarable summary hashing path More support for 7.25 Part 5. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193129 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 7 years ago
2 changed file(s) with 70 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
200200
201201 // Step 5
202202 // If the tag in Step 3 is one of ...
203 if (Tag == dwarf::DW_TAG_pointer_type) {
203 if (Tag == dwarf::DW_TAG_pointer_type ||
204 Tag == dwarf::DW_TAG_reference_type ||
205 Tag == dwarf::DW_TAG_rvalue_reference_type) {
204206 // ... and the referenced type (via the DW_AT_type or DW_AT_friend
205207 // attribute) ...
206208 assert(Desc->getAttribute() == dwarf::DW_AT_type ||
197197
198198 ASSERT_EQ(0x74ea73862e8708d2ULL, MD5Res);
199199 }
200 }
200
201 // struct foo { foo &mem; };
202 TEST(DIEHashTest, Reference) {
203 DIE Foo(dwarf::DW_TAG_structure_type);
204 DIEInteger Eight(8);
205 Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
206 DIEString FooStr(&Eight, "foo");
207 Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
208
209 DIE *Mem = new DIE(dwarf::DW_TAG_member);
210 DIEString MemStr(&Eight, "mem");
211 Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
212 DIEInteger Zero(0);
213 Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1, &Zero);
214
215 DIE FooRef(dwarf::DW_TAG_reference_type);
216 FooRef.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
217 DIEEntry FooEntry(&Foo);
218 FooRef.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooEntry);
219
220 DIE FooRefConst(dwarf::DW_TAG_const_type);
221 DIEEntry FooRefRef(&FooRef);
222 FooRefConst.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefRef);
223
224 DIEEntry FooRefConstRef(&FooRefConst);
225 Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefConstRef);
226
227 Foo.addChild(Mem);
228
229 uint64_t MD5Res = DIEHash().computeTypeSignature(&Foo);
230
231 ASSERT_EQ(0xa0b15f467ad4525bULL, MD5Res);
232 }
233
234 // struct foo { foo &&mem; };
235 TEST(DIEHashTest, RValueReference) {
236 DIE Foo(dwarf::DW_TAG_structure_type);
237 DIEInteger Eight(8);
238 Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
239 DIEString FooStr(&Eight, "foo");
240 Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
241
242 DIE *Mem = new DIE(dwarf::DW_TAG_member);
243 DIEString MemStr(&Eight, "mem");
244 Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
245 DIEInteger Zero(0);
246 Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1, &Zero);
247
248 DIE FooRef(dwarf::DW_TAG_rvalue_reference_type);
249 FooRef.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
250 DIEEntry FooEntry(&Foo);
251 FooRef.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooEntry);
252
253 DIE FooRefConst(dwarf::DW_TAG_const_type);
254 DIEEntry FooRefRef(&FooRef);
255 FooRefConst.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefRef);
256
257 DIEEntry FooRefConstRef(&FooRefConst);
258 Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefConstRef);
259
260 Foo.addChild(Mem);
261
262 uint64_t MD5Res = DIEHash().computeTypeSignature(&Foo);
263
264 ASSERT_EQ(0xad211c8c3b31e57ULL, MD5Res);
265 }
266 }