DIEEntry: Refer to the specified DIE via reference rather than pointer.

Makes some more cases (the unit tests, specifically), lexically
compatible with a change to unique_ptr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207261 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2014-04-25 19:33:43 +00:00
parent d48f5efa9d
commit 172515f0be
7 changed files with 58 additions and 59 deletions

View File

@ -376,12 +376,12 @@ void DIEEntry::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {
if (Form == dwarf::DW_FORM_ref_addr) { if (Form == dwarf::DW_FORM_ref_addr) {
const DwarfDebug *DD = AP->getDwarfDebug(); const DwarfDebug *DD = AP->getDwarfDebug();
unsigned Addr = Entry->getOffset(); unsigned Addr = Entry.getOffset();
assert(!DD->useSplitDwarf() && "TODO: dwo files can't have relocations."); assert(!DD->useSplitDwarf() && "TODO: dwo files can't have relocations.");
// For DW_FORM_ref_addr, output the offset from beginning of debug info // For DW_FORM_ref_addr, output the offset from beginning of debug info
// section. Entry->getOffset() returns the offset from start of the // section. Entry->getOffset() returns the offset from start of the
// compile unit. // compile unit.
DwarfCompileUnit *CU = DD->lookupUnit(Entry->getUnit()); DwarfCompileUnit *CU = DD->lookupUnit(Entry.getUnit());
assert(CU && "CUDie should belong to a CU."); assert(CU && "CUDie should belong to a CU.");
Addr += CU->getDebugInfoOffset(); Addr += CU->getDebugInfoOffset();
if (AP->MAI->doesDwarfUseRelocationsAcrossSections()) if (AP->MAI->doesDwarfUseRelocationsAcrossSections())
@ -392,7 +392,7 @@ void DIEEntry::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {
CU->getSectionSym(), CU->getSectionSym(),
DIEEntry::getRefAddrSize(AP)); DIEEntry::getRefAddrSize(AP));
} else } else
AP->EmitInt32(Entry->getOffset()); AP->EmitInt32(Entry.getOffset());
} }
unsigned DIEEntry::getRefAddrSize(AsmPrinter *AP) { unsigned DIEEntry::getRefAddrSize(AsmPrinter *AP) {
@ -409,7 +409,7 @@ unsigned DIEEntry::getRefAddrSize(AsmPrinter *AP) {
#ifndef NDEBUG #ifndef NDEBUG
void DIEEntry::print(raw_ostream &O) const { void DIEEntry::print(raw_ostream &O) const {
O << format("Die: 0x%lx", (long)(intptr_t)Entry); O << format("Die: 0x%lx", (long)(intptr_t)&Entry);
} }
#endif #endif

View File

@ -405,14 +405,13 @@ public:
/// this class can also be used as a proxy for a debug information entry not /// this class can also be used as a proxy for a debug information entry not
/// yet defined (ie. types.) /// yet defined (ie. types.)
class DIEEntry : public DIEValue { class DIEEntry : public DIEValue {
DIE *const Entry; DIE &Entry;
public: public:
explicit DIEEntry(DIE *E) : DIEValue(isEntry), Entry(E) { explicit DIEEntry(DIE &E) : DIEValue(isEntry), Entry(E) {
assert(E && "Cannot construct a DIEEntry with a null DIE");
} }
DIE *getEntry() const { return Entry; } DIE &getEntry() const { return Entry; }
/// EmitValue - Emit debug information entry offset. /// EmitValue - Emit debug information entry offset.
/// ///

View File

@ -309,7 +309,7 @@ void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
// ... An attribute that refers to another type entry T is processed as // ... An attribute that refers to another type entry T is processed as
// follows: // follows:
case DIEValue::isEntry: case DIEValue::isEntry:
hashDIEEntry(Attribute, Tag, *cast<DIEEntry>(Value)->getEntry()); hashDIEEntry(Attribute, Tag, cast<DIEEntry>(Value)->getEntry());
break; break;
case DIEValue::isInteger: { case DIEValue::isInteger: {
addULEB128('A'); addULEB128('A');

View File

@ -323,7 +323,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit &SPCU,
if (DIE *AbsSPDIE = AbstractSPDies.lookup(SP)) { if (DIE *AbsSPDIE = AbstractSPDies.lookup(SP)) {
// Pick up abstract subprogram DIE. // Pick up abstract subprogram DIE.
SPDie = &SPCU.createAndAddDIE(dwarf::DW_TAG_subprogram, SPCU.getUnitDie()); SPDie = &SPCU.createAndAddDIE(dwarf::DW_TAG_subprogram, SPCU.getUnitDie());
SPCU.addDIEEntry(*SPDie, dwarf::DW_AT_abstract_origin, AbsSPDIE); SPCU.addDIEEntry(*SPDie, dwarf::DW_AT_abstract_origin, *AbsSPDIE);
} else { } else {
DISubprogram SPDecl = SP.getFunctionDeclaration(); DISubprogram SPDecl = SP.getFunctionDeclaration();
if (!SPDecl.isSubprogram()) { if (!SPDecl.isSubprogram()) {
@ -346,7 +346,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit &SPCU,
DIE *SPDeclDie = SPDie; DIE *SPDeclDie = SPDie;
SPDie = SPDie =
&SPCU.createAndAddDIE(dwarf::DW_TAG_subprogram, SPCU.getUnitDie()); &SPCU.createAndAddDIE(dwarf::DW_TAG_subprogram, SPCU.getUnitDie());
SPCU.addDIEEntry(*SPDie, dwarf::DW_AT_specification, SPDeclDie); SPCU.addDIEEntry(*SPDie, dwarf::DW_AT_specification, *SPDeclDie);
} }
} }
} }
@ -471,7 +471,7 @@ DIE *DwarfDebug::constructInlinedScopeDIE(DwarfCompileUnit &TheCU,
} }
DIE *ScopeDIE = new DIE(dwarf::DW_TAG_inlined_subroutine); DIE *ScopeDIE = new DIE(dwarf::DW_TAG_inlined_subroutine);
TheCU.addDIEEntry(*ScopeDIE, dwarf::DW_AT_abstract_origin, OriginDIE); TheCU.addDIEEntry(*ScopeDIE, dwarf::DW_AT_abstract_origin, *OriginDIE);
// If we have multiple ranges, emit them into the range section. // If we have multiple ranges, emit them into the range section.
if (ScopeRanges.size() > 1) if (ScopeRanges.size() > 1)
@ -614,7 +614,7 @@ DIE *DwarfDebug::constructScopeDIE(DwarfCompileUnit &TheCU,
ScopeDIE->addChild(I); ScopeDIE->addChild(I);
if (DS.isSubprogram() && ObjectPointer != nullptr) if (DS.isSubprogram() && ObjectPointer != nullptr)
TheCU.addDIEEntry(*ScopeDIE, dwarf::DW_AT_object_pointer, ObjectPointer); TheCU.addDIEEntry(*ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer);
return ScopeDIE; return ScopeDIE;
} }
@ -748,7 +748,7 @@ void DwarfDebug::constructImportedEntityDIE(DwarfCompileUnit &TheCU,
TheCU.addSourceLine(IMDie, Module.getLineNumber(), TheCU.addSourceLine(IMDie, Module.getLineNumber(),
Module.getContext().getFilename(), Module.getContext().getFilename(),
Module.getContext().getDirectory()); Module.getContext().getDirectory());
TheCU.addDIEEntry(IMDie, dwarf::DW_AT_import, EntityDie); TheCU.addDIEEntry(IMDie, dwarf::DW_AT_import, *EntityDie);
StringRef Name = Module.getName(); StringRef Name = Module.getName();
if (!Name.empty()) if (!Name.empty())
TheCU.addString(IMDie, dwarf::DW_AT_name, Name); TheCU.addString(IMDie, dwarf::DW_AT_name, Name);
@ -1939,8 +1939,8 @@ static dwarf::PubIndexEntryDescriptor computeIndexValue(DwarfUnit *CU,
// look for that now. // look for that now.
DIEValue *SpecVal = Die->findAttribute(dwarf::DW_AT_specification); DIEValue *SpecVal = Die->findAttribute(dwarf::DW_AT_specification);
if (SpecVal) { if (SpecVal) {
DIE *SpecDIE = cast<DIEEntry>(SpecVal)->getEntry(); DIE &SpecDIE = cast<DIEEntry>(SpecVal)->getEntry();
if (SpecDIE->findAttribute(dwarf::DW_AT_external)) if (SpecDIE.findAttribute(dwarf::DW_AT_external))
Linkage = dwarf::GIEL_EXTERNAL; Linkage = dwarf::GIEL_EXTERNAL;
} else if (Die->findAttribute(dwarf::DW_AT_external)) } else if (Die->findAttribute(dwarf::DW_AT_external))
Linkage = dwarf::GIEL_EXTERNAL; Linkage = dwarf::GIEL_EXTERNAL;

View File

@ -75,7 +75,7 @@ DwarfUnit::~DwarfUnit() {
/// createDIEEntry - Creates a new DIEEntry to be a proxy for a debug /// createDIEEntry - Creates a new DIEEntry to be a proxy for a debug
/// information entry. /// information entry.
DIEEntry *DwarfUnit::createDIEEntry(DIE *Entry) { DIEEntry *DwarfUnit::createDIEEntry(DIE &Entry) {
DIEEntry *Value = new (DIEValueAllocator) DIEEntry(Entry); DIEEntry *Value = new (DIEValueAllocator) DIEEntry(Entry);
return Value; return Value;
} }
@ -355,7 +355,7 @@ void DwarfUnit::addLabelDelta(DIE &Die, dwarf::Attribute Attribute,
/// addDIEEntry - Add a DIE attribute data and value. /// addDIEEntry - Add a DIE attribute data and value.
/// ///
void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE *Entry) { void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry) {
addDIEEntry(Die, Attribute, createDIEEntry(Entry)); addDIEEntry(Die, Attribute, createDIEEntry(Entry));
} }
@ -367,7 +367,7 @@ void DwarfUnit::addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type) {
void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute,
DIEEntry *Entry) { DIEEntry *Entry) {
const DIE *DieCU = Die.getUnitOrNull(); const DIE *DieCU = Die.getUnitOrNull();
const DIE *EntryCU = Entry->getEntry()->getUnitOrNull(); const DIE *EntryCU = Entry->getEntry().getUnitOrNull();
if (!DieCU) if (!DieCU)
// We assume that Die belongs to this CU, if it is not linked to any CU yet. // We assume that Die belongs to this CU, if it is not linked to any CU yet.
DieCU = &getUnitDie(); DieCU = &getUnitDie();
@ -1055,7 +1055,7 @@ void DwarfUnit::addType(DIE &Entity, DIType Ty, dwarf::Attribute Attribute) {
DIE *Buffer = getOrCreateTypeDIE(Ty); DIE *Buffer = getOrCreateTypeDIE(Ty);
// Set up proxy. // Set up proxy.
Entry = createDIEEntry(Buffer); Entry = createDIEEntry(*Buffer);
insertDIEEntry(Ty, Entry); insertDIEEntry(Ty, Entry);
addDIEEntry(Entity, Attribute, Entry); addDIEEntry(Entity, Attribute, Entry);
} }
@ -1149,7 +1149,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DIDerivedType DTy) {
if (Tag == dwarf::DW_TAG_ptr_to_member_type) if (Tag == dwarf::DW_TAG_ptr_to_member_type)
addDIEEntry(Buffer, dwarf::DW_AT_containing_type, addDIEEntry(Buffer, dwarf::DW_AT_containing_type,
getOrCreateTypeDIE(resolve(DTy.getClassType()))); *getOrCreateTypeDIE(resolve(DTy.getClassType())));
// Add source line info if available and TyDesc is not a forward declaration. // Add source line info if available and TyDesc is not a forward declaration.
if (!DTy.isForwardDecl()) if (!DTy.isForwardDecl())
addSourceLine(Buffer, DTy); addSourceLine(Buffer, DTy);
@ -1267,7 +1267,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
DIEEntry *Entry = getDIEEntry(Element); DIEEntry *Entry = getDIEEntry(Element);
if (!Entry) { if (!Entry) {
Entry = createDIEEntry(&ElemDie); Entry = createDIEEntry(ElemDie);
insertDIEEntry(Element, Entry); insertDIEEntry(Element, Entry);
} }
} else } else
@ -1280,7 +1280,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
DICompositeType ContainingType(resolve(CTy.getContainingType())); DICompositeType ContainingType(resolve(CTy.getContainingType()));
if (ContainingType) if (ContainingType)
addDIEEntry(Buffer, dwarf::DW_AT_containing_type, addDIEEntry(Buffer, dwarf::DW_AT_containing_type,
getOrCreateTypeDIE(ContainingType)); *getOrCreateTypeDIE(ContainingType));
if (CTy.isObjcClassComplete()) if (CTy.isObjcClassComplete())
addFlag(Buffer, dwarf::DW_AT_APPLE_objc_complete_type); addFlag(Buffer, dwarf::DW_AT_APPLE_objc_complete_type);
@ -1431,7 +1431,7 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
if (DeclDie) if (DeclDie)
// Refer function declaration directly. // Refer function declaration directly.
addDIEEntry(SPDie, dwarf::DW_AT_specification, DeclDie); addDIEEntry(SPDie, dwarf::DW_AT_specification, *DeclDie);
// Add the linkage name if we have one and it isn't in the Decl. // Add the linkage name if we have one and it isn't in the Decl.
StringRef LinkageName = SP.getLinkageName(); StringRef LinkageName = SP.getLinkageName();
@ -1638,7 +1638,7 @@ void DwarfCompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) {
!GVContext.isFile() && !DD->isSubprogramContext(GVContext)) { !GVContext.isFile() && !DD->isSubprogramContext(GVContext)) {
// Create specification DIE. // Create specification DIE.
VariableSpecDIE = &createAndAddDIE(dwarf::DW_TAG_variable, *UnitDie); VariableSpecDIE = &createAndAddDIE(dwarf::DW_TAG_variable, *UnitDie);
addDIEEntry(*VariableSpecDIE, dwarf::DW_AT_specification, VariableDIE); addDIEEntry(*VariableSpecDIE, dwarf::DW_AT_specification, *VariableDIE);
addBlock(*VariableSpecDIE, dwarf::DW_AT_location, Loc); addBlock(*VariableSpecDIE, dwarf::DW_AT_location, Loc);
// A static member's declaration is already flagged as such. // A static member's declaration is already flagged as such.
if (!SDMDecl.Verify()) if (!SDMDecl.Verify())
@ -1699,7 +1699,7 @@ void DwarfCompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) {
/// constructSubrangeDIE - Construct subrange DIE from DISubrange. /// constructSubrangeDIE - Construct subrange DIE from DISubrange.
void DwarfUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy) { void DwarfUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy) {
DIE &DW_Subrange = createAndAddDIE(dwarf::DW_TAG_subrange_type, Buffer); DIE &DW_Subrange = createAndAddDIE(dwarf::DW_TAG_subrange_type, Buffer);
addDIEEntry(DW_Subrange, dwarf::DW_AT_type, IndexTy); addDIEEntry(DW_Subrange, dwarf::DW_AT_type, *IndexTy);
// The LowerBound value defines the lower bounds which is typically zero for // The LowerBound value defines the lower bounds which is typically zero for
// C/C++. The Count value is the number of elements. Values are 64 bit. If // C/C++. The Count value is the number of elements. Values are 64 bit. If
@ -1788,7 +1788,7 @@ void DwarfUnit::constructContainingTypeDIEs() {
DIE *NDie = getDIE(D); DIE *NDie = getDIE(D);
if (!NDie) if (!NDie)
continue; continue;
addDIEEntry(SPDie, dwarf::DW_AT_containing_type, NDie); addDIEEntry(SPDie, dwarf::DW_AT_containing_type, *NDie);
} }
} }
@ -1808,7 +1808,7 @@ DIE *DwarfUnit::constructVariableDIEImpl(const DbgVariable &DV,
DbgVariable *AbsVar = DV.getAbstractVariable(); DbgVariable *AbsVar = DV.getAbstractVariable();
DIE *AbsDIE = AbsVar ? AbsVar->getDIE() : nullptr; DIE *AbsDIE = AbsVar ? AbsVar->getDIE() : nullptr;
if (AbsDIE) if (AbsDIE)
addDIEEntry(*VariableDie, dwarf::DW_AT_abstract_origin, AbsDIE); addDIEEntry(*VariableDie, dwarf::DW_AT_abstract_origin, *AbsDIE);
else { else {
if (!Name.empty()) if (!Name.empty())
addString(*VariableDie, dwarf::DW_AT_name, Name); addString(*VariableDie, dwarf::DW_AT_name, Name);

View File

@ -328,7 +328,7 @@ public:
const MCSymbol *Lo); const MCSymbol *Lo);
/// addDIEEntry - Add a DIE attribute data and value. /// addDIEEntry - Add a DIE attribute data and value.
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE *Entry); void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry);
/// addDIEEntry - Add a DIE attribute data and value. /// addDIEEntry - Add a DIE attribute data and value.
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIEEntry *Entry); void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIEEntry *Entry);
@ -516,7 +516,7 @@ private:
/// createDIEEntry - Creates a new DIEEntry to be a proxy for a debug /// createDIEEntry - Creates a new DIEEntry to be a proxy for a debug
/// information entry. /// information entry.
DIEEntry *createDIEEntry(DIE *Entry); DIEEntry *createDIEEntry(DIE &Entry);
/// resolve - Look in the DwarfDebug map for the MDNode that /// resolve - Look in the DwarfDebug map for the MDNode that
/// corresponds to the reference. /// corresponds to the reference.

View File

@ -103,7 +103,7 @@ TEST(DIEHashTest, TypeWithMember) {
DIEInteger Five(5); DIEInteger Five(5);
Int.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Five); Int.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Five);
DIEEntry IntRef(&Int); DIEEntry IntRef(Int);
Member->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef); Member->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef);
uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed); uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);
@ -142,7 +142,7 @@ TEST(DIEHashTest, ReusedType) {
DIEInteger Five(5); DIEInteger Five(5);
Int.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Five); Int.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Five);
DIEEntry IntRef(&Int); DIEEntry IntRef(Int);
Mem1->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef); Mem1->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef);
Mem2->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef); Mem2->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef);
@ -162,7 +162,7 @@ TEST(DIEHashTest, RecursiveType) {
DIE *Mem = new DIE(dwarf::DW_TAG_member); DIE *Mem = new DIE(dwarf::DW_TAG_member);
DIEString MemStr(&One, "mem"); DIEString MemStr(&One, "mem");
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr); Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
DIEEntry FooRef(&Foo); DIEEntry FooRef(Foo);
Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRef); Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRef);
// DW_AT_external and DW_AT_declaration are ignored anyway, so skip them. // DW_AT_external and DW_AT_declaration are ignored anyway, so skip them.
@ -189,10 +189,10 @@ TEST(DIEHashTest, Pointer) {
DIE FooPtr(dwarf::DW_TAG_pointer_type); DIE FooPtr(dwarf::DW_TAG_pointer_type);
FooPtr.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight); FooPtr.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
DIEEntry FooRef(&Foo); DIEEntry FooRef(Foo);
FooPtr.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRef); FooPtr.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRef);
DIEEntry FooPtrRef(&FooPtr); DIEEntry FooPtrRef(FooPtr);
Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooPtrRef); Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooPtrRef);
Foo.addChild(Mem); Foo.addChild(Mem);
@ -218,14 +218,14 @@ TEST(DIEHashTest, Reference) {
DIE FooRef(dwarf::DW_TAG_reference_type); DIE FooRef(dwarf::DW_TAG_reference_type);
FooRef.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight); FooRef.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
DIEEntry FooEntry(&Foo); DIEEntry FooEntry(Foo);
FooRef.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooEntry); FooRef.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooEntry);
DIE FooRefConst(dwarf::DW_TAG_const_type); DIE FooRefConst(dwarf::DW_TAG_const_type);
DIEEntry FooRefRef(&FooRef); DIEEntry FooRefRef(FooRef);
FooRefConst.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefRef); FooRefConst.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefRef);
DIEEntry FooRefConstRef(&FooRefConst); DIEEntry FooRefConstRef(FooRefConst);
Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefConstRef); Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefConstRef);
Foo.addChild(Mem); Foo.addChild(Mem);
@ -251,14 +251,14 @@ TEST(DIEHashTest, RValueReference) {
DIE FooRef(dwarf::DW_TAG_rvalue_reference_type); DIE FooRef(dwarf::DW_TAG_rvalue_reference_type);
FooRef.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight); FooRef.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
DIEEntry FooEntry(&Foo); DIEEntry FooEntry(Foo);
FooRef.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooEntry); FooRef.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooEntry);
DIE FooRefConst(dwarf::DW_TAG_const_type); DIE FooRefConst(dwarf::DW_TAG_const_type);
DIEEntry FooRefRef(&FooRef); DIEEntry FooRefRef(FooRef);
FooRefConst.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefRef); FooRefConst.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefRef);
DIEEntry FooRefConstRef(&FooRefConst); DIEEntry FooRefConstRef(FooRefConst);
Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefConstRef); Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRefConstRef);
Foo.addChild(Mem); Foo.addChild(Mem);
@ -283,12 +283,12 @@ TEST(DIEHashTest, PtrToMember) {
Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1, &Zero); Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1, &Zero);
DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type); DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);
DIEEntry FooEntry(&Foo); DIEEntry FooEntry(Foo);
PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooEntry); PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooEntry);
PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,
&FooEntry); &FooEntry);
DIEEntry PtrToFooMemRef(&PtrToFooMem); DIEEntry PtrToFooMemRef(PtrToFooMem);
Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &PtrToFooMemRef); Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &PtrToFooMemRef);
Foo.addChild(Mem); Foo.addChild(Mem);
@ -326,13 +326,13 @@ TEST(DIEHashTest, PtrToMemberDeclDefMatch) {
&Zero); &Zero);
DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type); DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);
DIEEntry BarEntry(&Bar); DIEEntry BarEntry(Bar);
PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &BarEntry); PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &BarEntry);
DIEEntry FooEntry(&Foo); DIEEntry FooEntry(Foo);
PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,
&FooEntry); &FooEntry);
DIEEntry PtrToFooMemRef(&PtrToFooMem); DIEEntry PtrToFooMemRef(PtrToFooMem);
Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &PtrToFooMemRef); Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &PtrToFooMemRef);
Foo.addChild(Mem); Foo.addChild(Mem);
@ -355,13 +355,13 @@ TEST(DIEHashTest, PtrToMemberDeclDefMatch) {
&Zero); &Zero);
DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type); DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);
DIEEntry BarEntry(&Bar); DIEEntry BarEntry(Bar);
PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &BarEntry); PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &BarEntry);
DIEEntry FooEntry(&Foo); DIEEntry FooEntry(Foo);
PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,
&FooEntry); &FooEntry);
DIEEntry PtrToFooMemRef(&PtrToFooMem); DIEEntry PtrToFooMemRef(PtrToFooMem);
Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &PtrToFooMemRef); Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &PtrToFooMemRef);
Foo.addChild(Mem); Foo.addChild(Mem);
@ -399,12 +399,12 @@ TEST(DIEHashTest, PtrToMemberDeclDefMisMatch) {
&Zero); &Zero);
DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type); DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);
DIEEntry BarEntry(&Bar); DIEEntry BarEntry(Bar);
PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &BarEntry); PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &BarEntry);
PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,
&BarEntry); &BarEntry);
DIEEntry PtrToFooMemRef(&PtrToFooMem); DIEEntry PtrToFooMemRef(PtrToFooMem);
Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &PtrToFooMemRef); Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &PtrToFooMemRef);
Foo.addChild(Mem); Foo.addChild(Mem);
@ -427,12 +427,12 @@ TEST(DIEHashTest, PtrToMemberDeclDefMisMatch) {
&Zero); &Zero);
DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type); DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);
DIEEntry BarEntry(&Bar); DIEEntry BarEntry(Bar);
PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &BarEntry); PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &BarEntry);
PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,
&BarEntry); &BarEntry);
DIEEntry PtrToFooMemRef(&PtrToFooMem); DIEEntry PtrToFooMemRef(PtrToFooMem);
Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &PtrToFooMemRef); Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &PtrToFooMemRef);
Foo.addChild(Mem); Foo.addChild(Mem);
@ -469,10 +469,10 @@ TEST(DIEHashTest, RefUnnamedType) {
DIE UnnamedPtr(dwarf::DW_TAG_pointer_type); DIE UnnamedPtr(dwarf::DW_TAG_pointer_type);
UnnamedPtr.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight); UnnamedPtr.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
DIEEntry UnnamedRef(&Unnamed); DIEEntry UnnamedRef(Unnamed);
UnnamedPtr.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &UnnamedRef); UnnamedPtr.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &UnnamedRef);
DIEEntry UnnamedPtrRef(&UnnamedPtr); DIEEntry UnnamedPtrRef(UnnamedPtr);
Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &UnnamedPtrRef); Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &UnnamedPtrRef);
Foo.addChild(Mem); Foo.addChild(Mem);
@ -572,11 +572,11 @@ TEST(DIEHashTest, MemberSdata) {
IntTyDIE.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Five); IntTyDIE.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Five);
IntTyDIE.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FStr); IntTyDIE.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FStr);
DIEEntry IntTy(&IntTyDIE); DIEEntry IntTy(IntTyDIE);
DIE *PITyDIE = new DIE(dwarf::DW_TAG_const_type); DIE *PITyDIE = new DIE(dwarf::DW_TAG_const_type);
PITyDIE->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntTy); PITyDIE->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntTy);
DIEEntry PITy(PITyDIE); DIEEntry PITy(*PITyDIE);
DIE *PI = new DIE(dwarf::DW_TAG_member); DIE *PI = new DIE(dwarf::DW_TAG_member);
DIEString PIStr(&One, "PI"); DIEString PIStr(&One, "PI");
DIEInteger Two(2); DIEInteger Two(2);
@ -616,11 +616,11 @@ TEST(DIEHashTest, MemberBlock) {
FloatTyDIE->addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Four); FloatTyDIE->addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Four);
FloatTyDIE->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FStr); FloatTyDIE->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FStr);
DIEEntry FloatTy(FloatTyDIE); DIEEntry FloatTy(*FloatTyDIE);
DIE *PITyDIE = new DIE(dwarf::DW_TAG_const_type); DIE *PITyDIE = new DIE(dwarf::DW_TAG_const_type);
PITyDIE->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FloatTy); PITyDIE->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FloatTy);
DIEEntry PITy(PITyDIE); DIEEntry PITy(*PITyDIE);
DIE *PI = new DIE(dwarf::DW_TAG_member); DIE *PI = new DIE(dwarf::DW_TAG_member);
DIEString PIStr(&One, "PI"); DIEString PIStr(&One, "PI");
DIEInteger Two(2); DIEInteger Two(2);