summaryrefslogtreecommitdiff
path: root/unittests/CodeGen
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-10-25 18:38:43 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-10-25 18:38:43 +0000
commita954618c6e6c5f94d3cedc0b6bc19dbc49e56ac2 (patch)
treee3bf6e25cc80684422154e73ad3d949bdad767ba /unittests/CodeGen
parented400c710890313116aeea9a070dce7956da44d1 (diff)
DIEHash: Summary hashing of nested types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193427 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/CodeGen')
-rw-r--r--unittests/CodeGen/DIEHashTest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/unittests/CodeGen/DIEHashTest.cpp b/unittests/CodeGen/DIEHashTest.cpp
index 6f71462bfdf..fb6f4b3640a 100644
--- a/unittests/CodeGen/DIEHashTest.cpp
+++ b/unittests/CodeGen/DIEHashTest.cpp
@@ -477,4 +477,23 @@ TEST(DIEHashTest, RefUnnamedType) {
ASSERT_EQ(0x954e026f01c02529ULL, MD5Res);
}
+
+// struct { struct bar { }; };
+TEST(DIEHashTest, NestedType) {
+ DIE Unnamed(dwarf::DW_TAG_structure_type);
+ DIEInteger One(1);
+ Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
+
+ DIE *Foo = new DIE(dwarf::DW_TAG_structure_type);
+ DIEString FooStr(&One, "foo");
+ Foo->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
+ Foo->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
+
+ Unnamed.addChild(Foo);
+
+ uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);
+
+ // The exact same hash GCC produces for this DIE.
+ ASSERT_EQ(0xde8a3b7b43807f4aULL, MD5Res);
+}
}