aboutsummaryrefslogtreecommitdiffstats
path: root/unittests/CodeGen
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-10-21 23:06:19 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-10-21 23:06:19 +0000
commit449f036a8141b9032ff310ecbe0ab4433c5c307b (patch)
treed4d402affa29fbd5dc4735e097ce02e0900b76d0 /unittests/CodeGen
parentf1545a219744c1ae66137e64d1c456cd8e924eb7 (diff)
downloadexternal_llvm-449f036a8141b9032ff310ecbe0ab4433c5c307b.zip
external_llvm-449f036a8141b9032ff310ecbe0ab4433c5c307b.tar.gz
external_llvm-449f036a8141b9032ff310ecbe0ab4433c5c307b.tar.bz2
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
Diffstat (limited to 'unittests/CodeGen')
-rw-r--r--unittests/CodeGen/DIEHashTest.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/unittests/CodeGen/DIEHashTest.cpp b/unittests/CodeGen/DIEHashTest.cpp
index 7d8b024..1ac8b3d 100644
--- a/unittests/CodeGen/DIEHashTest.cpp
+++ b/unittests/CodeGen/DIEHashTest.cpp
@@ -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);
+}
}