mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
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
This commit is contained in:
parent
f1545a2197
commit
449f036a81
@ -201,7 +201,9 @@ void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
|
||||
|
||||
// Step 5
|
||||
// If the tag in Step 3 is one of ...
|
||||
if (Tag == dwarf::DW_TAG_pointer_type) {
|
||||
if (Tag == dwarf::DW_TAG_pointer_type ||
|
||||
Tag == dwarf::DW_TAG_reference_type ||
|
||||
Tag == dwarf::DW_TAG_rvalue_reference_type) {
|
||||
// ... and the referenced type (via the DW_AT_type or DW_AT_friend
|
||||
// attribute) ...
|
||||
assert(Desc->getAttribute() == dwarf::DW_AT_type ||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user