mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
DIE: Pass ownership of children via std::unique_ptr rather than raw pointer.
This should reduce the chance of memory leaks like those fixed in r207240. There's still some unclear ownership of DIEs happening in DwarfDebug. Pushing unique_ptr and references through more APIs should help expose the cases where ownership is a bit fuzzy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207263 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
172515f0be
commit
12d5224df6
@ -172,11 +172,11 @@ public:
|
|||||||
|
|
||||||
/// addChild - Add a child to the DIE.
|
/// addChild - Add a child to the DIE.
|
||||||
///
|
///
|
||||||
void addChild(DIE *Child) {
|
void addChild(std::unique_ptr<DIE> Child) {
|
||||||
assert(!Child->getParent());
|
assert(!Child->getParent());
|
||||||
Abbrev.setChildrenFlag(dwarf::DW_CHILDREN_yes);
|
Abbrev.setChildrenFlag(dwarf::DW_CHILDREN_yes);
|
||||||
Children.push_back(std::unique_ptr<DIE>(Child));
|
|
||||||
Child->Parent = this;
|
Child->Parent = this;
|
||||||
|
Children.push_back(std::move(Child));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// findAttribute - Find a value in the DIE with the attribute given,
|
/// findAttribute - Find a value in the DIE with the attribute given,
|
||||||
|
@ -506,43 +506,45 @@ DIE *DwarfDebug::constructInlinedScopeDIE(DwarfCompileUnit &TheCU,
|
|||||||
return ScopeDIE;
|
return ScopeDIE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DIE *DwarfDebug::createScopeChildrenDIE(DwarfCompileUnit &TheCU,
|
DIE *DwarfDebug::createScopeChildrenDIE(
|
||||||
LexicalScope *Scope,
|
DwarfCompileUnit &TheCU, LexicalScope *Scope,
|
||||||
SmallVectorImpl<DIE *> &Children) {
|
SmallVectorImpl<std::unique_ptr<DIE>> &Children) {
|
||||||
DIE *ObjectPointer = nullptr;
|
DIE *ObjectPointer = nullptr;
|
||||||
|
|
||||||
// Collect arguments for current function.
|
// Collect arguments for current function.
|
||||||
if (LScopes.isCurrentFunctionScope(Scope)) {
|
if (LScopes.isCurrentFunctionScope(Scope)) {
|
||||||
for (DbgVariable *ArgDV : CurrentFnArguments)
|
for (DbgVariable *ArgDV : CurrentFnArguments)
|
||||||
if (ArgDV)
|
if (ArgDV) {
|
||||||
if (DIE *Arg =
|
std::unique_ptr<DIE> Arg =
|
||||||
TheCU.constructVariableDIE(*ArgDV, Scope->isAbstractScope())) {
|
TheCU.constructVariableDIE(*ArgDV, Scope->isAbstractScope());
|
||||||
Children.push_back(Arg);
|
assert(Arg);
|
||||||
if (ArgDV->isObjectPointer())
|
if (ArgDV->isObjectPointer())
|
||||||
ObjectPointer = Arg;
|
ObjectPointer = Arg.get();
|
||||||
}
|
Children.push_back(std::move(Arg));
|
||||||
|
}
|
||||||
|
|
||||||
// If this is a variadic function, add an unspecified parameter.
|
// If this is a variadic function, add an unspecified parameter.
|
||||||
DISubprogram SP(Scope->getScopeNode());
|
DISubprogram SP(Scope->getScopeNode());
|
||||||
DIArray FnArgs = SP.getType().getTypeArray();
|
DIArray FnArgs = SP.getType().getTypeArray();
|
||||||
if (FnArgs.getElement(FnArgs.getNumElements() - 1)
|
if (FnArgs.getElement(FnArgs.getNumElements() - 1)
|
||||||
.isUnspecifiedParameter()) {
|
.isUnspecifiedParameter()) {
|
||||||
DIE *Ellipsis = new DIE(dwarf::DW_TAG_unspecified_parameters);
|
Children.push_back(
|
||||||
Children.push_back(Ellipsis);
|
make_unique<DIE>(dwarf::DW_TAG_unspecified_parameters));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect lexical scope children first.
|
// Collect lexical scope children first.
|
||||||
for (DbgVariable *DV : ScopeVariables.lookup(Scope))
|
for (DbgVariable *DV : ScopeVariables.lookup(Scope)) {
|
||||||
if (DIE *Variable =
|
std::unique_ptr<DIE> Variable =
|
||||||
TheCU.constructVariableDIE(*DV, Scope->isAbstractScope())) {
|
TheCU.constructVariableDIE(*DV, Scope->isAbstractScope());
|
||||||
Children.push_back(Variable);
|
assert(Variable);
|
||||||
if (DV->isObjectPointer())
|
Children.push_back(std::move(Variable));
|
||||||
ObjectPointer = Variable;
|
if (DV->isObjectPointer())
|
||||||
}
|
ObjectPointer = Variable.get();
|
||||||
|
}
|
||||||
for (LexicalScope *LS : Scope->getChildren())
|
for (LexicalScope *LS : Scope->getChildren())
|
||||||
if (DIE *Nested = constructScopeDIE(TheCU, LS))
|
if (DIE *Nested = constructScopeDIE(TheCU, LS))
|
||||||
Children.push_back(Nested);
|
Children.push_back(std::unique_ptr<DIE>(Nested));
|
||||||
return ObjectPointer;
|
return ObjectPointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,7 +556,7 @@ DIE *DwarfDebug::constructScopeDIE(DwarfCompileUnit &TheCU,
|
|||||||
|
|
||||||
DIScope DS(Scope->getScopeNode());
|
DIScope DS(Scope->getScopeNode());
|
||||||
|
|
||||||
SmallVector<DIE *, 8> Children;
|
SmallVector<std::unique_ptr<DIE>, 8> Children;
|
||||||
DIE *ObjectPointer = nullptr;
|
DIE *ObjectPointer = nullptr;
|
||||||
bool ChildrenCreated = false;
|
bool ChildrenCreated = false;
|
||||||
|
|
||||||
@ -610,8 +612,8 @@ DIE *DwarfDebug::constructScopeDIE(DwarfCompileUnit &TheCU,
|
|||||||
ObjectPointer = createScopeChildrenDIE(TheCU, Scope, Children);
|
ObjectPointer = createScopeChildrenDIE(TheCU, Scope, Children);
|
||||||
|
|
||||||
// Add children
|
// Add children
|
||||||
for (DIE *I : Children)
|
for (auto &I : Children)
|
||||||
ScopeDIE->addChild(I);
|
ScopeDIE->addChild(std::move(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);
|
||||||
@ -862,8 +864,7 @@ void DwarfDebug::collectDeadVariables() {
|
|||||||
if (!DV.isVariable())
|
if (!DV.isVariable())
|
||||||
continue;
|
continue;
|
||||||
DbgVariable NewVar(DV, nullptr, this);
|
DbgVariable NewVar(DV, nullptr, this);
|
||||||
if (DIE *VariableDIE = SPCU->constructVariableDIE(NewVar, false))
|
SPDIE->addChild(SPCU->constructVariableDIE(NewVar, false));
|
||||||
SPDIE->addChild(VariableDIE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,7 +367,7 @@ class DwarfDebug : public AsmPrinterHandler {
|
|||||||
DIE *constructScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope);
|
DIE *constructScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope);
|
||||||
/// A helper function to create children of a Scope DIE.
|
/// A helper function to create children of a Scope DIE.
|
||||||
DIE *createScopeChildrenDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope,
|
DIE *createScopeChildrenDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope,
|
||||||
SmallVectorImpl<DIE *> &Children);
|
SmallVectorImpl<std::unique_ptr<DIE>> &Children);
|
||||||
|
|
||||||
/// \brief Emit initial Dwarf sections with a label at the start of each one.
|
/// \brief Emit initial Dwarf sections with a label at the start of each one.
|
||||||
void emitSectionLabels();
|
void emitSectionLabels();
|
||||||
|
@ -383,7 +383,7 @@ void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute,
|
|||||||
DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, DIDescriptor N) {
|
DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, DIDescriptor N) {
|
||||||
assert(Tag != dwarf::DW_TAG_auto_variable &&
|
assert(Tag != dwarf::DW_TAG_auto_variable &&
|
||||||
Tag != dwarf::DW_TAG_arg_variable);
|
Tag != dwarf::DW_TAG_arg_variable);
|
||||||
Parent.addChild(new DIE((dwarf::Tag)Tag));
|
Parent.addChild(make_unique<DIE>((dwarf::Tag)Tag));
|
||||||
DIE &Die = *Parent.getChildren().back();
|
DIE &Die = *Parent.getChildren().back();
|
||||||
if (N)
|
if (N)
|
||||||
insertDIE(N, &Die);
|
insertDIE(N, &Die);
|
||||||
@ -1793,18 +1793,19 @@ void DwarfUnit::constructContainingTypeDIEs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// constructVariableDIE - Construct a DIE for the given DbgVariable.
|
/// constructVariableDIE - Construct a DIE for the given DbgVariable.
|
||||||
DIE *DwarfUnit::constructVariableDIE(DbgVariable &DV, bool isScopeAbstract) {
|
std::unique_ptr<DIE> DwarfUnit::constructVariableDIE(DbgVariable &DV,
|
||||||
|
bool isScopeAbstract) {
|
||||||
auto D = constructVariableDIEImpl(DV, isScopeAbstract);
|
auto D = constructVariableDIEImpl(DV, isScopeAbstract);
|
||||||
DV.setDIE(*D);
|
DV.setDIE(*D);
|
||||||
return D;
|
return D;
|
||||||
}
|
}
|
||||||
|
|
||||||
DIE *DwarfUnit::constructVariableDIEImpl(const DbgVariable &DV,
|
std::unique_ptr<DIE> DwarfUnit::constructVariableDIEImpl(const DbgVariable &DV,
|
||||||
bool isScopeAbstract) {
|
bool isScopeAbstract) {
|
||||||
StringRef Name = DV.getName();
|
StringRef Name = DV.getName();
|
||||||
|
|
||||||
// Define variable debug information entry.
|
// Define variable debug information entry.
|
||||||
DIE *VariableDie = new DIE(DV.getTag());
|
auto VariableDie = make_unique<DIE>(DV.getTag());
|
||||||
DbgVariable *AbsVar = DV.getAbstractVariable();
|
DbgVariable *AbsVar = DV.getAbstractVariable();
|
||||||
DIE *AbsDIE = AbsVar ? AbsVar->getDIE() : nullptr;
|
DIE *AbsDIE = AbsVar ? AbsVar->getDIE() : nullptr;
|
||||||
if (AbsDIE)
|
if (AbsDIE)
|
||||||
|
@ -270,7 +270,7 @@ public:
|
|||||||
|
|
||||||
/// addDie - Adds or interns the DIE to the compile unit.
|
/// addDie - Adds or interns the DIE to the compile unit.
|
||||||
///
|
///
|
||||||
void addDie(DIE *Buffer) { UnitDie->addChild(Buffer); }
|
void addDie(DIE *Buffer) { UnitDie->addChild(std::unique_ptr<DIE>(Buffer)); }
|
||||||
|
|
||||||
/// addFlag - Add a flag that is true to the DIE.
|
/// addFlag - Add a flag that is true to the DIE.
|
||||||
void addFlag(DIE &Die, dwarf::Attribute Attribute);
|
void addFlag(DIE &Die, dwarf::Attribute Attribute);
|
||||||
@ -425,7 +425,8 @@ public:
|
|||||||
void constructContainingTypeDIEs();
|
void constructContainingTypeDIEs();
|
||||||
|
|
||||||
/// constructVariableDIE - Construct a DIE for the given DbgVariable.
|
/// constructVariableDIE - Construct a DIE for the given DbgVariable.
|
||||||
DIE *constructVariableDIE(DbgVariable &DV, bool isScopeAbstract);
|
std::unique_ptr<DIE> constructVariableDIE(DbgVariable &DV,
|
||||||
|
bool isScopeAbstract);
|
||||||
|
|
||||||
/// constructSubprogramArguments - Construct function argument DIEs.
|
/// constructSubprogramArguments - Construct function argument DIEs.
|
||||||
void constructSubprogramArguments(DIE &Buffer, DIArray Args);
|
void constructSubprogramArguments(DIE &Buffer, DIArray Args);
|
||||||
@ -459,7 +460,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
/// \brief Construct a DIE for the given DbgVariable without initializing the
|
/// \brief Construct a DIE for the given DbgVariable without initializing the
|
||||||
/// DbgVariable's DIE reference.
|
/// DbgVariable's DIE reference.
|
||||||
DIE *constructVariableDIEImpl(const DbgVariable &DV, bool isScopeAbstract);
|
std::unique_ptr<DIE> constructVariableDIEImpl(const DbgVariable &DV,
|
||||||
|
bool isScopeAbstract);
|
||||||
|
|
||||||
/// constructTypeDIE - Construct basic type die from DIBasicType.
|
/// constructTypeDIE - Construct basic type die from DIBasicType.
|
||||||
void constructTypeDIE(DIE &Buffer, DIBasicType BTy);
|
void constructTypeDIE(DIE &Buffer, DIBasicType BTy);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/Dwarf.h"
|
#include "llvm/Support/Dwarf.h"
|
||||||
#include "llvm/Support/Format.h"
|
#include "llvm/Support/Format.h"
|
||||||
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -59,7 +60,7 @@ TEST(DIEHashTest, NamedType) {
|
|||||||
TEST(DIEHashTest, NamespacedType) {
|
TEST(DIEHashTest, NamespacedType) {
|
||||||
DIE CU(dwarf::DW_TAG_compile_unit);
|
DIE CU(dwarf::DW_TAG_compile_unit);
|
||||||
|
|
||||||
DIE *Space = new DIE(dwarf::DW_TAG_namespace);
|
auto Space = make_unique<DIE>(dwarf::DW_TAG_namespace);
|
||||||
DIEInteger One(1);
|
DIEInteger One(1);
|
||||||
DIEString SpaceStr(&One, "space");
|
DIEString SpaceStr(&One, "space");
|
||||||
Space->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &SpaceStr);
|
Space->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &SpaceStr);
|
||||||
@ -67,15 +68,16 @@ TEST(DIEHashTest, NamespacedType) {
|
|||||||
Space->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, &One);
|
Space->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, &One);
|
||||||
// sibling?
|
// sibling?
|
||||||
|
|
||||||
DIE *Foo = new DIE(dwarf::DW_TAG_structure_type);
|
auto Foo = make_unique<DIE>(dwarf::DW_TAG_structure_type);
|
||||||
DIEString FooStr(&One, "foo");
|
DIEString FooStr(&One, "foo");
|
||||||
Foo->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
Foo->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
||||||
Foo->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
|
Foo->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
|
||||||
|
|
||||||
Space->addChild(Foo);
|
DIE &N = *Foo;
|
||||||
CU.addChild(Space);
|
Space->addChild(std::move(Foo));
|
||||||
|
CU.addChild(std::move(Space));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(*Foo);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(N);
|
||||||
|
|
||||||
// The exact same hash GCC produces for this DIE.
|
// The exact same hash GCC produces for this DIE.
|
||||||
ASSERT_EQ(0x7b80381fd17f1e33ULL, MD5Res);
|
ASSERT_EQ(0x7b80381fd17f1e33ULL, MD5Res);
|
||||||
@ -87,15 +89,6 @@ TEST(DIEHashTest, TypeWithMember) {
|
|||||||
DIEInteger Four(4);
|
DIEInteger Four(4);
|
||||||
Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four);
|
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);
|
|
||||||
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);
|
DIE Int(dwarf::DW_TAG_base_type);
|
||||||
DIEString IntStr(&Four, "int");
|
DIEString IntStr(&Four, "int");
|
||||||
Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &IntStr);
|
Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &IntStr);
|
||||||
@ -104,8 +97,17 @@ TEST(DIEHashTest, TypeWithMember) {
|
|||||||
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);
|
||||||
|
|
||||||
|
auto Member = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
|
DIEString MemberStr(&Four, "member");
|
||||||
|
Member->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemberStr);
|
||||||
|
DIEInteger Zero(0);
|
||||||
|
Member->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
||||||
|
&Zero);
|
||||||
Member->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef);
|
Member->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef);
|
||||||
|
|
||||||
|
Unnamed.addChild(std::move(Member));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);
|
||||||
|
|
||||||
ASSERT_EQ(0x5646aa436b7e07c6ULL, MD5Res);
|
ASSERT_EQ(0x5646aa436b7e07c6ULL, MD5Res);
|
||||||
@ -117,24 +119,7 @@ TEST(DIEHashTest, ReusedType) {
|
|||||||
DIEInteger Eight(8);
|
DIEInteger Eight(8);
|
||||||
Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
|
Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
|
||||||
|
|
||||||
DIE *Mem1 = new DIE(dwarf::DW_TAG_member);
|
|
||||||
DIEInteger Four(4);
|
DIEInteger Four(4);
|
||||||
DIEString Mem1Str(&Four, "mem1");
|
|
||||||
Mem1->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &Mem1Str);
|
|
||||||
DIEInteger Zero(0);
|
|
||||||
Mem1->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
|
||||||
&Zero);
|
|
||||||
|
|
||||||
Unnamed.addChild(Mem1);
|
|
||||||
|
|
||||||
DIE *Mem2 = new DIE(dwarf::DW_TAG_member);
|
|
||||||
DIEString Mem2Str(&Four, "mem2");
|
|
||||||
Mem2->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &Mem2Str);
|
|
||||||
Mem2->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
|
||||||
&Four);
|
|
||||||
|
|
||||||
Unnamed.addChild(Mem2);
|
|
||||||
|
|
||||||
DIE Int(dwarf::DW_TAG_base_type);
|
DIE Int(dwarf::DW_TAG_base_type);
|
||||||
DIEString IntStr(&Four, "int");
|
DIEString IntStr(&Four, "int");
|
||||||
Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &IntStr);
|
Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &IntStr);
|
||||||
@ -143,9 +128,26 @@ TEST(DIEHashTest, ReusedType) {
|
|||||||
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);
|
||||||
|
|
||||||
|
auto Mem1 = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
|
DIEString Mem1Str(&Four, "mem1");
|
||||||
|
Mem1->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &Mem1Str);
|
||||||
|
DIEInteger Zero(0);
|
||||||
|
Mem1->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
||||||
|
&Zero);
|
||||||
Mem1->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef);
|
Mem1->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef);
|
||||||
|
|
||||||
|
Unnamed.addChild(std::move(Mem1));
|
||||||
|
|
||||||
|
auto Mem2 = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
|
DIEString Mem2Str(&Four, "mem2");
|
||||||
|
Mem2->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &Mem2Str);
|
||||||
|
Mem2->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
||||||
|
&Four);
|
||||||
Mem2->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef);
|
Mem2->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef);
|
||||||
|
|
||||||
|
Unnamed.addChild(std::move(Mem2));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);
|
||||||
|
|
||||||
ASSERT_EQ(0x3a7dc3ed7b76b2f8ULL, MD5Res);
|
ASSERT_EQ(0x3a7dc3ed7b76b2f8ULL, MD5Res);
|
||||||
@ -159,14 +161,14 @@ TEST(DIEHashTest, RecursiveType) {
|
|||||||
DIEString FooStr(&One, "foo");
|
DIEString FooStr(&One, "foo");
|
||||||
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
||||||
|
|
||||||
DIE *Mem = new DIE(dwarf::DW_TAG_member);
|
auto Mem = make_unique<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.
|
||||||
|
|
||||||
Foo.addChild(Mem);
|
Foo.addChild(std::move(Mem));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);
|
||||||
|
|
||||||
@ -181,7 +183,7 @@ TEST(DIEHashTest, Pointer) {
|
|||||||
DIEString FooStr(&Eight, "foo");
|
DIEString FooStr(&Eight, "foo");
|
||||||
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
||||||
|
|
||||||
DIE *Mem = new DIE(dwarf::DW_TAG_member);
|
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
DIEString MemStr(&Eight, "mem");
|
DIEString MemStr(&Eight, "mem");
|
||||||
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
||||||
DIEInteger Zero(0);
|
DIEInteger Zero(0);
|
||||||
@ -195,7 +197,7 @@ TEST(DIEHashTest, Pointer) {
|
|||||||
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(std::move(Mem));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);
|
||||||
|
|
||||||
@ -210,7 +212,7 @@ TEST(DIEHashTest, Reference) {
|
|||||||
DIEString FooStr(&Eight, "foo");
|
DIEString FooStr(&Eight, "foo");
|
||||||
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
||||||
|
|
||||||
DIE *Mem = new DIE(dwarf::DW_TAG_member);
|
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
DIEString MemStr(&Eight, "mem");
|
DIEString MemStr(&Eight, "mem");
|
||||||
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
||||||
DIEInteger Zero(0);
|
DIEInteger Zero(0);
|
||||||
@ -228,7 +230,7 @@ TEST(DIEHashTest, Reference) {
|
|||||||
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(std::move(Mem));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);
|
||||||
|
|
||||||
@ -243,7 +245,7 @@ TEST(DIEHashTest, RValueReference) {
|
|||||||
DIEString FooStr(&Eight, "foo");
|
DIEString FooStr(&Eight, "foo");
|
||||||
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
||||||
|
|
||||||
DIE *Mem = new DIE(dwarf::DW_TAG_member);
|
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
DIEString MemStr(&Eight, "mem");
|
DIEString MemStr(&Eight, "mem");
|
||||||
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
||||||
DIEInteger Zero(0);
|
DIEInteger Zero(0);
|
||||||
@ -261,7 +263,7 @@ TEST(DIEHashTest, RValueReference) {
|
|||||||
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(std::move(Mem));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);
|
||||||
|
|
||||||
@ -276,7 +278,7 @@ TEST(DIEHashTest, PtrToMember) {
|
|||||||
DIEString FooStr(&Eight, "foo");
|
DIEString FooStr(&Eight, "foo");
|
||||||
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
||||||
|
|
||||||
DIE *Mem = new DIE(dwarf::DW_TAG_member);
|
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
DIEString MemStr(&Eight, "mem");
|
DIEString MemStr(&Eight, "mem");
|
||||||
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
||||||
DIEInteger Zero(0);
|
DIEInteger Zero(0);
|
||||||
@ -291,7 +293,7 @@ TEST(DIEHashTest, PtrToMember) {
|
|||||||
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(std::move(Mem));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);
|
||||||
|
|
||||||
@ -320,7 +322,7 @@ TEST(DIEHashTest, PtrToMemberDeclDefMatch) {
|
|||||||
Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
|
Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
|
||||||
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
||||||
|
|
||||||
DIE *Mem = new DIE(dwarf::DW_TAG_member);
|
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
||||||
Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
||||||
&Zero);
|
&Zero);
|
||||||
@ -335,7 +337,7 @@ TEST(DIEHashTest, PtrToMemberDeclDefMatch) {
|
|||||||
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(std::move(Mem));
|
||||||
|
|
||||||
MD5ResDecl = DIEHash().computeTypeSignature(Foo);
|
MD5ResDecl = DIEHash().computeTypeSignature(Foo);
|
||||||
}
|
}
|
||||||
@ -349,7 +351,7 @@ TEST(DIEHashTest, PtrToMemberDeclDefMatch) {
|
|||||||
Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
|
Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
|
||||||
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
||||||
|
|
||||||
DIE *Mem = new DIE(dwarf::DW_TAG_member);
|
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
||||||
Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
||||||
&Zero);
|
&Zero);
|
||||||
@ -364,7 +366,7 @@ TEST(DIEHashTest, PtrToMemberDeclDefMatch) {
|
|||||||
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(std::move(Mem));
|
||||||
|
|
||||||
MD5ResDef = DIEHash().computeTypeSignature(Foo);
|
MD5ResDef = DIEHash().computeTypeSignature(Foo);
|
||||||
}
|
}
|
||||||
@ -393,7 +395,7 @@ TEST(DIEHashTest, PtrToMemberDeclDefMisMatch) {
|
|||||||
Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
|
Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
|
||||||
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
||||||
|
|
||||||
DIE *Mem = new DIE(dwarf::DW_TAG_member);
|
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
||||||
Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
||||||
&Zero);
|
&Zero);
|
||||||
@ -407,7 +409,7 @@ TEST(DIEHashTest, PtrToMemberDeclDefMisMatch) {
|
|||||||
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(std::move(Mem));
|
||||||
|
|
||||||
MD5ResDecl = DIEHash().computeTypeSignature(Foo);
|
MD5ResDecl = DIEHash().computeTypeSignature(Foo);
|
||||||
}
|
}
|
||||||
@ -421,7 +423,7 @@ TEST(DIEHashTest, PtrToMemberDeclDefMisMatch) {
|
|||||||
Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
|
Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
|
||||||
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
||||||
|
|
||||||
DIE *Mem = new DIE(dwarf::DW_TAG_member);
|
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
||||||
Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
|
||||||
&Zero);
|
&Zero);
|
||||||
@ -435,7 +437,7 @@ TEST(DIEHashTest, PtrToMemberDeclDefMisMatch) {
|
|||||||
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(std::move(Mem));
|
||||||
|
|
||||||
MD5ResDef = DIEHash().computeTypeSignature(Foo);
|
MD5ResDef = DIEHash().computeTypeSignature(Foo);
|
||||||
}
|
}
|
||||||
@ -463,7 +465,7 @@ TEST(DIEHashTest, RefUnnamedType) {
|
|||||||
Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
|
Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);
|
||||||
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
||||||
|
|
||||||
DIE *Mem = new DIE(dwarf::DW_TAG_member);
|
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);
|
||||||
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);
|
||||||
|
|
||||||
@ -475,7 +477,7 @@ TEST(DIEHashTest, RefUnnamedType) {
|
|||||||
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(std::move(Mem));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);
|
||||||
|
|
||||||
@ -488,12 +490,12 @@ TEST(DIEHashTest, NestedType) {
|
|||||||
DIEInteger One(1);
|
DIEInteger One(1);
|
||||||
Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
|
Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
|
||||||
|
|
||||||
DIE *Foo = new DIE(dwarf::DW_TAG_structure_type);
|
auto Foo = make_unique<DIE>(dwarf::DW_TAG_structure_type);
|
||||||
DIEString FooStr(&One, "foo");
|
DIEString FooStr(&One, "foo");
|
||||||
Foo->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
Foo->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);
|
||||||
Foo->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
|
Foo->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
|
||||||
|
|
||||||
Unnamed.addChild(Foo);
|
Unnamed.addChild(std::move(Foo));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);
|
||||||
|
|
||||||
@ -507,11 +509,11 @@ TEST(DIEHashTest, MemberFunc) {
|
|||||||
DIEInteger One(1);
|
DIEInteger One(1);
|
||||||
Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
|
Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
|
||||||
|
|
||||||
DIE *Func = new DIE(dwarf::DW_TAG_subprogram);
|
auto Func = make_unique<DIE>(dwarf::DW_TAG_subprogram);
|
||||||
DIEString FuncStr(&One, "func");
|
DIEString FuncStr(&One, "func");
|
||||||
Func->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FuncStr);
|
Func->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FuncStr);
|
||||||
|
|
||||||
Unnamed.addChild(Func);
|
Unnamed.addChild(std::move(Func));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);
|
||||||
|
|
||||||
@ -531,7 +533,7 @@ TEST(DIEHashTest, MemberFuncFlag) {
|
|||||||
A.addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, &One);
|
A.addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, &One);
|
||||||
A.addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, &One);
|
A.addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, &One);
|
||||||
|
|
||||||
DIE *Func = new DIE(dwarf::DW_TAG_subprogram);
|
auto Func = make_unique<DIE>(dwarf::DW_TAG_subprogram);
|
||||||
DIEString FuncStr(&One, "func");
|
DIEString FuncStr(&One, "func");
|
||||||
DIEString FuncLinkage(&One, "_ZN1A4funcEv");
|
DIEString FuncLinkage(&One, "_ZN1A4funcEv");
|
||||||
DIEInteger Two(2);
|
DIEInteger Two(2);
|
||||||
@ -542,7 +544,7 @@ TEST(DIEHashTest, MemberFuncFlag) {
|
|||||||
Func->addValue(dwarf::DW_AT_linkage_name, dwarf::DW_FORM_strp, &FuncLinkage);
|
Func->addValue(dwarf::DW_AT_linkage_name, dwarf::DW_FORM_strp, &FuncLinkage);
|
||||||
Func->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, &One);
|
Func->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, &One);
|
||||||
|
|
||||||
A.addChild(Func);
|
A.addChild(std::move(Func));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(A);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(A);
|
||||||
|
|
||||||
@ -573,11 +575,11 @@ TEST(DIEHashTest, MemberSdata) {
|
|||||||
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);
|
auto PITyDIE = make_unique<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);
|
auto PI = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
DIEString PIStr(&One, "PI");
|
DIEString PIStr(&One, "PI");
|
||||||
DIEInteger Two(2);
|
DIEInteger Two(2);
|
||||||
DIEInteger NegThree(-3);
|
DIEInteger NegThree(-3);
|
||||||
@ -589,7 +591,7 @@ TEST(DIEHashTest, MemberSdata) {
|
|||||||
PI->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, &One);
|
PI->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, &One);
|
||||||
PI->addValue(dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata, &NegThree);
|
PI->addValue(dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata, &NegThree);
|
||||||
|
|
||||||
A.addChild(PI);
|
A.addChild(std::move(PI));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(A);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(A);
|
||||||
ASSERT_EQ(0x9a216000dd3788a7ULL, MD5Res);
|
ASSERT_EQ(0x9a216000dd3788a7ULL, MD5Res);
|
||||||
@ -611,17 +613,17 @@ TEST(DIEHashTest, MemberBlock) {
|
|||||||
|
|
||||||
DIEInteger Four(4);
|
DIEInteger Four(4);
|
||||||
DIEString FStr(&One, "float");
|
DIEString FStr(&One, "float");
|
||||||
DIE *FloatTyDIE = new DIE(dwarf::DW_TAG_base_type);
|
auto FloatTyDIE = make_unique<DIE>(dwarf::DW_TAG_base_type);
|
||||||
FloatTyDIE->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four);
|
FloatTyDIE->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four);
|
||||||
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);
|
auto PITyDIE = make_unique<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);
|
auto PI = make_unique<DIE>(dwarf::DW_TAG_member);
|
||||||
DIEString PIStr(&One, "PI");
|
DIEString PIStr(&One, "PI");
|
||||||
DIEInteger Two(2);
|
DIEInteger Two(2);
|
||||||
PI->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &PIStr);
|
PI->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &PIStr);
|
||||||
@ -644,7 +646,7 @@ TEST(DIEHashTest, MemberBlock) {
|
|||||||
|
|
||||||
PI->addValue(dwarf::DW_AT_const_value, dwarf::DW_FORM_block1, &PIBlock);
|
PI->addValue(dwarf::DW_AT_const_value, dwarf::DW_FORM_block1, &PIBlock);
|
||||||
|
|
||||||
A.addChild(PI);
|
A.addChild(std::move(PI));
|
||||||
|
|
||||||
uint64_t MD5Res = DIEHash().computeTypeSignature(A);
|
uint64_t MD5Res = DIEHash().computeTypeSignature(A);
|
||||||
ASSERT_EQ(0x493af53ad3d3f651ULL, MD5Res);
|
ASSERT_EQ(0x493af53ad3d3f651ULL, MD5Res);
|
||||||
|
Loading…
Reference in New Issue
Block a user