llvm.org GIT mirror llvm / 7c0c2e5
DIEHash: Summary hashing of member functions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193432 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 7 years ago
2 changed file(s) with 20 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
412412 I != E; ++I) {
413413 // 7.27 Step 7
414414 // If C is a nested type entry or a member function entry, ...
415 if (isType((*I)->getTag())) {
415 if (isType((*I)->getTag()) || (*I)->getTag() == dwarf::DW_TAG_subprogram) {
416416 StringRef Name = getDIEStringAttr(**I, dwarf::DW_AT_name);
417417 // ... and has a DW_AT_name attribute
418418 if (!Name.empty()) {
495495 // The exact same hash GCC produces for this DIE.
496496 ASSERT_EQ(0xde8a3b7b43807f4aULL, MD5Res);
497497 }
498 }
498
499 // struct { static void func(); };
500 TEST(DIEHashTest, MemberFunc) {
501 DIE Unnamed(dwarf::DW_TAG_structure_type);
502 DIEInteger One(1);
503 Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
504
505 DIE *Func = new DIE(dwarf::DW_TAG_subprogram);
506 DIEString FuncStr(&One, "func");
507 Func->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FuncStr);
508
509 Unnamed.addChild(Func);
510
511 uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);
512
513 // The exact same hash GCC produces for this DIE.
514 ASSERT_EQ(0xd36a1b6dfb604ba0ULL, MD5Res);
515 }
516 }