diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-10-25 18:38:43 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-10-25 18:38:43 +0000 |
commit | a954618c6e6c5f94d3cedc0b6bc19dbc49e56ac2 (patch) | |
tree | e3bf6e25cc80684422154e73ad3d949bdad767ba /unittests/CodeGen | |
parent | ed400c710890313116aeea9a070dce7956da44d1 (diff) | |
download | external_llvm-a954618c6e6c5f94d3cedc0b6bc19dbc49e56ac2.zip external_llvm-a954618c6e6c5f94d3cedc0b6bc19dbc49e56ac2.tar.gz external_llvm-a954618c6e6c5f94d3cedc0b6bc19dbc49e56ac2.tar.bz2 |
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.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
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 @@ 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); +} } |