[llvm] r193129 - DWARF Type Hashing: Include reference and rvalue reference type in the declarable summary hashing path
David Blaikie
dblaikie at gmail.com
Mon Oct 21 16:06:19 PDT 2013
Author: dblaikie
Date: Mon Oct 21 18:06:19 2013
New Revision: 193129
URL: http://llvm.org/viewvc/llvm-project?rev=193129&view=rev
Log:
DWARF Type Hashing: Include reference and rvalue reference type in the declarable summary hashing path
More support for 7.25 Part 5.
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=193129&r1=193128&r2=193129&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp Mon Oct 21 18:06:19 2013
@@ -201,7 +201,9 @@ void DIEHash::hashAttribute(AttrEntry At
// Step 5
// If the tag in Step 3 is one of ...
- if (Tag == dwarf::DW_TAG_pointer_type) {
+ if (Tag == dwarf::DW_TAG_pointer_type ||
+ Tag == dwarf::DW_TAG_reference_type ||
+ Tag == dwarf::DW_TAG_rvalue_reference_type) {
// ... and the referenced type (via the DW_AT_type or DW_AT_friend
// attribute) ...
assert(Desc->getAttribute() == dwarf::DW_AT_type ||
Modified: llvm/trunk/unittests/CodeGen/DIEHashTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CodeGen/DIEHashTest.cpp?rev=193129&r1=193128&r2=193129&view=diff
==============================================================================
--- llvm/trunk/unittests/CodeGen/DIEHashTest.cpp (original)
+++ llvm/trunk/unittests/CodeGen/DIEHashTest.cpp Mon Oct 21 18:06:19 2013
@@ -198,4 +198,70 @@ TEST(DIEHashTest, Pointer) {
ASSERT_EQ(0x74ea73862e8708d2ULL, MD5Res);
}
+
+// struct foo { foo &mem; };
+TEST(DIEHashTest, Reference) {
+ DIE Foo(dwarf::DW_TAG_structure_type);
+ DIEInteger Eight(8);
+ Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
+ DIEString FooStr(&Eight, "foo");
+ Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
+
+ DIE *Mem = new DIE(dwarf::DW_TAG_member);
+ DIEString MemStr(&Eight, "mem");
+ Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
+ DIEInteger Zero(0);
+ Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1, &Zero);
+
+ DIE FooRef(dwarf::DW_TAG_reference_type);
+ FooRef.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
+ DIEEntry FooEntry(&Foo);
+ FooRef.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooEntry);
+
+ DIE FooRefConst(dwarf::DW_TAG_const_type);
+ DIEEntry FooRefRef(&FooRef);
+ FooRefConst.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefRef);
+
+ DIEEntry FooRefConstRef(&FooRefConst);
+ Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefConstRef);
+
+ Foo.addChild(Mem);
+
+ uint64_t MD5Res = DIEHash().computeTypeSignature(&Foo);
+
+ ASSERT_EQ(0xa0b15f467ad4525bULL, MD5Res);
+}
+
+// struct foo { foo &&mem; };
+TEST(DIEHashTest, RValueReference) {
+ DIE Foo(dwarf::DW_TAG_structure_type);
+ DIEInteger Eight(8);
+ Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
+ DIEString FooStr(&Eight, "foo");
+ Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
+
+ DIE *Mem = new DIE(dwarf::DW_TAG_member);
+ DIEString MemStr(&Eight, "mem");
+ Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
+ DIEInteger Zero(0);
+ Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1, &Zero);
+
+ DIE FooRef(dwarf::DW_TAG_rvalue_reference_type);
+ FooRef.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
+ DIEEntry FooEntry(&Foo);
+ FooRef.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooEntry);
+
+ DIE FooRefConst(dwarf::DW_TAG_const_type);
+ DIEEntry FooRefRef(&FooRef);
+ FooRefConst.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefRef);
+
+ DIEEntry FooRefConstRef(&FooRefConst);
+ Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefConstRef);
+
+ Foo.addChild(Mem);
+
+ uint64_t MD5Res = DIEHash().computeTypeSignature(&Foo);
+
+ ASSERT_EQ(0xad211c8c3b31e57ULL, MD5Res);
+}
}
More information about the llvm-commits
mailing list