diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-10-17 22:07:09 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-10-17 22:07:09 +0000 |
commit | 47f66d5a756d4eaeba9082ff4c82023a213daf45 (patch) | |
tree | b00ba7ffbd91bf60a7c7b479e2425d57d811d2ed /unittests | |
parent | 7014d274e4adb51cbb20201ab002057395b7dcaa (diff) | |
download | external_llvm-47f66d5a756d4eaeba9082ff4c82023a213daf45.zip external_llvm-47f66d5a756d4eaeba9082ff4c82023a213daf45.tar.gz external_llvm-47f66d5a756d4eaeba9082ff4c82023a213daf45.tar.bz2 |
DIEHash: Support for simple (non-recursive, non-reused) type references
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192924 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/CodeGen/DIEHashTest.cpp | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/unittests/CodeGen/DIEHashTest.cpp b/unittests/CodeGen/DIEHashTest.cpp index fd1845e..834a16a2 100644 --- a/unittests/CodeGen/DIEHashTest.cpp +++ b/unittests/CodeGen/DIEHashTest.cpp @@ -51,9 +51,6 @@ TEST(NamedType, DIEHash) { Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr); Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One); - // Line and file number are ignored. - Foo.addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, &One); - Foo.addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, &One); uint64_t MD5Res = DIEHash().computeTypeSignature(&Foo); // The exact same hash GCC produces for this DIE. @@ -78,10 +75,6 @@ TEST(NamespacedType, DIEHash) { Foo->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr); Foo->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One); - // Line and file number are ignored. - Foo->addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, &One); - Foo->addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, &One); - Space->addChild(Foo); CU.addChild(Space); @@ -90,4 +83,33 @@ TEST(NamespacedType, DIEHash) { // The exact same hash GCC produces for this DIE. ASSERT_EQ(0x7b80381fd17f1e33ULL, MD5Res); } + +TEST(TypeWithMember, DIEHash) { + DIE Unnamed(dwarf::DW_TAG_structure_type); + DIEInteger Four(4); + Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four); + + DIE *Member = new DIE(dwarf::DW_TAG_member); + DIEString MemberStr(&Four, "member"); + Member->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemberStr); + // type + DIEInteger Zero(0); + Member->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1, &Zero); + + Unnamed.addChild(Member); + + DIE Int(dwarf::DW_TAG_base_type); + DIEString IntStr(&Four, "int"); + Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &IntStr); + Int.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four); + DIEInteger Five(5); + Int.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Five); + + DIEEntry IntRef(&Int); + Member->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef); + + uint64_t MD5Res = DIEHash().computeTypeSignature(&Unnamed); + + ASSERT_EQ(0x5646aa436b7e07c6ULL, MD5Res); +} } |