[llvm] r193432 - DIEHash: Summary hashing of member functions
David Blaikie
dblaikie at gmail.com
Fri Oct 25 13:04:25 PDT 2013
Author: dblaikie
Date: Fri Oct 25 15:04:25 2013
New Revision: 193432
URL: http://llvm.org/viewvc/llvm-project?rev=193432&view=rev
Log:
DIEHash: Summary hashing of member functions
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
llvm/trunk/unittests/CodeGen/DIEHashTest.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp?rev=193432&r1=193431&r2=193432&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp Fri Oct 25 15:04:25 2013
@@ -413,7 +413,7 @@ void DIEHash::computeHash(const DIE &Die
I != E; ++I) {
// 7.27 Step 7
// If C is a nested type entry or a member function entry, ...
- if (isType((*I)->getTag())) {
+ if (isType((*I)->getTag()) || (*I)->getTag() == dwarf::DW_TAG_subprogram) {
StringRef Name = getDIEStringAttr(**I, dwarf::DW_AT_name);
// ... and has a DW_AT_name attribute
if (!Name.empty()) {
Modified: llvm/trunk/unittests/CodeGen/DIEHashTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CodeGen/DIEHashTest.cpp?rev=193432&r1=193431&r2=193432&view=diff
==============================================================================
--- llvm/trunk/unittests/CodeGen/DIEHashTest.cpp (original)
+++ llvm/trunk/unittests/CodeGen/DIEHashTest.cpp Fri Oct 25 15:04:25 2013
@@ -496,4 +496,22 @@ TEST(DIEHashTest, NestedType) {
// The exact same hash GCC produces for this DIE.
ASSERT_EQ(0xde8a3b7b43807f4aULL, MD5Res);
}
+
+// struct { static void func(); };
+TEST(DIEHashTest, MemberFunc) {
+ DIE Unnamed(dwarf::DW_TAG_structure_type);
+ DIEInteger One(1);
+ Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
+
+ DIE *Func = new DIE(dwarf::DW_TAG_subprogram);
+ DIEString FuncStr(&One, "func");
+ Func->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FuncStr);
+
+ Unnamed.addChild(Func);
+
+ uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);
+
+ // The exact same hash GCC produces for this DIE.
+ ASSERT_EQ(0xd36a1b6dfb604ba0ULL, MD5Res);
+}
}
More information about the llvm-commits
mailing list