[llvm] r192836 - DIEHash: Include the trailing zero byte after the children of a DIE

David Blaikie dblaikie at gmail.com
Wed Oct 16 13:29:06 PDT 2013


Author: dblaikie
Date: Wed Oct 16 15:29:06 2013
New Revision: 192836

URL: http://llvm.org/viewvc/llvm-project?rev=192836&view=rev
Log:
DIEHash: Include the trailing zero byte after the children of a DIE

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=192836&r1=192835&r2=192836&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp Wed Oct 16 15:29:06 2013
@@ -383,6 +383,9 @@ void DIEHash::computeHash(DIE *Die) {
                                           E = Die->getChildren().end();
        I != E; ++I)
     computeHash(*I);
+
+  // Following the last (or if there are no children), append a zero byte.
+  Hash.update((uint8_t)0);
 }
 
 /// This is based on the type signature computation given in section 7.27 of the

Modified: llvm/trunk/unittests/CodeGen/DIEHashTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CodeGen/DIEHashTest.cpp?rev=192836&r1=192835&r2=192836&view=diff
==============================================================================
--- llvm/trunk/unittests/CodeGen/DIEHashTest.cpp (original)
+++ llvm/trunk/unittests/CodeGen/DIEHashTest.cpp Wed Oct 16 15:29:06 2013
@@ -23,6 +23,6 @@ TEST(DIEHashData1Test, DIEHash) {
   DIEInteger Size(4);
   Die.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Size);
   uint64_t MD5Res = Hash.computeTypeSignature(&Die);
-  ASSERT_EQ(MD5Res, 0x540e9ff30ade3e4aULL);
+  ASSERT_EQ(MD5Res, 0x4F68EF1039F8D2BULL);
 }
 }





More information about the llvm-commits mailing list