DIEHash: Summary hashing of nested types

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193427 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/CodeGen/DIEHashTest.cpp b/unittests/CodeGen/DIEHashTest.cpp
index 6f71462..fb6f4b3 100644
--- a/unittests/CodeGen/DIEHashTest.cpp
+++ b/unittests/CodeGen/DIEHashTest.cpp
@@ -477,4 +477,23 @@
 
   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);
+}
 }