summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-10-22 18:14:41 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-10-22 18:14:41 +0000
commitf196208900e690fe2d3bb1c6ca393d3fcd64226d (patch)
tree8061602901d3c45944cc0cfce3a569a8538d7db1 /lib/CodeGen
parent51ec77d880ce53cbc8a48168185edc085df9b6d9 (diff)
downloadllvm-f196208900e690fe2d3bb1c6ca393d3fcd64226d.tar.gz
llvm-f196208900e690fe2d3bb1c6ca393d3fcd64226d.tar.bz2
llvm-f196208900e690fe2d3bb1c6ca393d3fcd64226d.tar.xz
DWARF type hashing: pointers to members
Includes a test case/FIXME demonstrating a bug/limitation in pointer to member hashing. To be honest I'm not sure why we don't just always use summary hashing for referenced types... but perhaps I'm missing something. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193175 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/DIEHash.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/CodeGen/AsmPrinter/DIEHash.cpp b/lib/CodeGen/AsmPrinter/DIEHash.cpp
index 64a8fd50ed..9a1f966c8d 100644
--- a/lib/CodeGen/AsmPrinter/DIEHash.cpp
+++ b/lib/CodeGen/AsmPrinter/DIEHash.cpp
@@ -192,6 +192,7 @@ void DIEHash::collectAttributes(DIE *Die, DIEAttrs &Attrs) {
void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
const DIEValue *Value = Attr.Val;
const DIEAbbrevData *Desc = Attr.Desc;
+ dwarf::Attribute Attribute = Desc->getAttribute();
// 7.27 Step 3
// ... An attribute that refers to another type entry T is processed as
@@ -200,14 +201,16 @@ void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
DIE *Entry = EntryAttr->getEntry();
// Step 5
- // If the tag in Step 3 is one of ...
- 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 ||
- Desc->getAttribute() == dwarf::DW_AT_friend);
+ // If the tag in Step 3 is one of [the below tags]
+ if ((Tag == dwarf::DW_TAG_pointer_type ||
+ Tag == dwarf::DW_TAG_reference_type ||
+ Tag == dwarf::DW_TAG_rvalue_reference_type ||
+ Tag == dwarf::DW_TAG_ptr_to_member_type) &&
+ // and the referenced type (via the [below attributes])
+ // FIXME: This seems overly restrictive, and causes hash mismatches
+ // there's a decl/def difference in the containing type of a
+ // ptr_to_member_type.
+ Attribute == dwarf::DW_AT_type) {
// [FIXME] ... has a DW_AT_name attribute,
// append the letter 'N'
addULEB128('N');
@@ -238,7 +241,7 @@ void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
// 'R' as the marker
addULEB128('R');
- addULEB128(Desc->getAttribute());
+ addULEB128(Attribute);
// and use the unsigned LEB128 encoding of [the index of T in the
// list] as the attribute value;
@@ -249,7 +252,7 @@ void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
// otherwise, b) use the letter 'T' as a the marker, ...
addULEB128('T');
- addULEB128(Desc->getAttribute());
+ addULEB128(Attribute);
// ... process the type T recursively by performing Steps 2 through 7, and
// use the result as the attribute value.
@@ -261,7 +264,7 @@ void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
// Other attribute values use the letter 'A' as the marker, ...
addULEB128('A');
- addULEB128(Desc->getAttribute());
+ addULEB128(Attribute);
// ... and the value consists of the form code (encoded as an unsigned LEB128
// value) followed by the encoding of the value according to the form code. To