// Construct a DIE for this scope.
void DwarfCompileUnit::constructScopeDIE(
- LexicalScope *Scope, SmallVectorImpl<std::unique_ptr<DIE>> &FinalChildren) {
+ LexicalScope *Scope, SmallVectorImpl<DIE *> &FinalChildren) {
if (!Scope || !Scope->getScopeNode())
return;
"constructSubprogramScopeDIE for non-inlined "
"subprograms");
- SmallVector<std::unique_ptr<DIE>, 8> Children;
+ SmallVector<DIE *, 8> Children;
// We try to create the scope DIE first, then the children DIEs. This will
// avoid creating un-used children then removing them later when we find out
// the scope DIE is null.
- std::unique_ptr<DIE> ScopeDIE;
+ DIE *ScopeDIE;
if (Scope->getParent() && isa<DISubprogram>(DS)) {
ScopeDIE = constructInlinedScopeDIE(Scope);
if (!ScopeDIE)
// This scope represents inlined body of a function. Construct DIE to
// represent this concrete inlined copy of the function.
-std::unique_ptr<DIE>
-DwarfCompileUnit::constructInlinedScopeDIE(LexicalScope *Scope) {
+DIE *DwarfCompileUnit::constructInlinedScopeDIE(LexicalScope *Scope) {
assert(Scope->getScopeNode());
auto *DS = Scope->getScopeNode();
auto *InlinedSP = getDISubprogram(DS);
DIE *OriginDIE = DU->getAbstractSPDies()[InlinedSP];
assert(OriginDIE && "Unable to find original DIE for an inlined subprogram.");
- auto ScopeDIE = make_unique<DIE>(dwarf::DW_TAG_inlined_subroutine);
+ auto ScopeDIE = DIE::get(DIEValueAllocator, dwarf::DW_TAG_inlined_subroutine);
addDIEEntry(*ScopeDIE, dwarf::DW_AT_abstract_origin, *OriginDIE);
attachRangesOrLowHighPC(*ScopeDIE, Scope->getRanges());
// Construct new DW_TAG_lexical_block for this scope and attach
// DW_AT_low_pc/DW_AT_high_pc labels.
-std::unique_ptr<DIE>
-DwarfCompileUnit::constructLexicalScopeDIE(LexicalScope *Scope) {
+DIE *DwarfCompileUnit::constructLexicalScopeDIE(LexicalScope *Scope) {
if (DD->isLexicalScopeDIENull(Scope))
return nullptr;
- auto ScopeDIE = make_unique<DIE>(dwarf::DW_TAG_lexical_block);
+ auto ScopeDIE = DIE::get(DIEValueAllocator, dwarf::DW_TAG_lexical_block);
if (Scope->isAbstractScope())
return ScopeDIE;
}
/// constructVariableDIE - Construct a DIE for the given DbgVariable.
-std::unique_ptr<DIE> DwarfCompileUnit::constructVariableDIE(DbgVariable &DV,
- bool Abstract) {
+DIE *DwarfCompileUnit::constructVariableDIE(DbgVariable &DV, bool Abstract) {
auto D = constructVariableDIEImpl(DV, Abstract);
DV.setDIE(*D);
return D;
}
-std::unique_ptr<DIE>
-DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV,
- bool Abstract) {
+DIE *DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV,
+ bool Abstract) {
// Define variable debug information entry.
- auto VariableDie = make_unique<DIE>(DV.getTag());
+ auto VariableDie = DIE::get(DIEValueAllocator, DV.getTag());
if (Abstract) {
applyVariableAttributes(DV, *VariableDie);
return VariableDie;
}
-std::unique_ptr<DIE> DwarfCompileUnit::constructVariableDIE(
- DbgVariable &DV, const LexicalScope &Scope, DIE *&ObjectPointer) {
+DIE *DwarfCompileUnit::constructVariableDIE(DbgVariable &DV,
+ const LexicalScope &Scope,
+ DIE *&ObjectPointer) {
auto Var = constructVariableDIE(DV, Scope.isAbstractScope());
if (DV.isObjectPointer())
- ObjectPointer = Var.get();
+ ObjectPointer = Var;
return Var;
}
-DIE *DwarfCompileUnit::createScopeChildrenDIE(
- LexicalScope *Scope, SmallVectorImpl<std::unique_ptr<DIE>> &Children,
- unsigned *ChildScopeCount) {
+DIE *DwarfCompileUnit::createScopeChildrenDIE(LexicalScope *Scope,
+ SmallVectorImpl<DIE *> &Children,
+ unsigned *ChildScopeCount) {
DIE *ObjectPointer = nullptr;
for (DbgVariable *DV : DU->getScopeVariables().lookup(Scope))
// variadic function.
if (FnArgs.size() > 1 && !FnArgs[FnArgs.size() - 1] &&
!includeMinimalInlineScopes())
- ScopeDIE.addChild(make_unique<DIE>(dwarf::DW_TAG_unspecified_parameters));
+ ScopeDIE.addChild(
+ DIE::get(DIEValueAllocator, dwarf::DW_TAG_unspecified_parameters));
}
DIE *DwarfCompileUnit::createAndAddScopeChildren(LexicalScope *Scope,
DIE &ScopeDIE) {
// We create children when the scope DIE is not null.
- SmallVector<std::unique_ptr<DIE>, 8> Children;
+ SmallVector<DIE *, 8> Children;
DIE *ObjectPointer = createScopeChildrenDIE(Scope, Children);
// Add children
addDIEEntry(*AbsDef, dwarf::DW_AT_object_pointer, *ObjectPointer);
}
-std::unique_ptr<DIE>
-DwarfCompileUnit::constructImportedEntityDIE(const DIImportedEntity *Module) {
- std::unique_ptr<DIE> IMDie = make_unique<DIE>((dwarf::Tag)Module->getTag());
- insertDIE(Module, IMDie.get());
+DIE *DwarfCompileUnit::constructImportedEntityDIE(
+ const DIImportedEntity *Module) {
+ DIE *IMDie = DIE::get(DIEValueAllocator, (dwarf::Tag)Module->getTag());
+ insertDIE(Module, IMDie);
DIE *EntityDie;
auto *Entity = resolve(Module->getEntity());
if (auto *NS = dyn_cast<DINamespace>(Entity))
TEST_F(DIEHashTest, Data1) {
DIEHash Hash;
- DIE Die(dwarf::DW_TAG_base_type);
+ DIE &Die = *DIE::get(Alloc, dwarf::DW_TAG_base_type);
DIEInteger Size(4);
Die.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Size);
uint64_t MD5Res = Hash.computeTypeSignature(Die);
// struct {};
TEST_F(DIEHashTest, TrivialType) {
- DIE Unnamed(dwarf::DW_TAG_structure_type);
+ DIE &Unnamed = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger One(1);
Unnamed.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);
// struct foo { };
TEST_F(DIEHashTest, NamedType) {
- DIE Foo(dwarf::DW_TAG_structure_type);
+ DIE &Foo = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger One(1);
DIEString FooStr = getString("foo");
Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
// namespace space { struct foo { }; }
TEST_F(DIEHashTest, NamespacedType) {
- DIE CU(dwarf::DW_TAG_compile_unit);
+ DIE &CU = *DIE::get(Alloc, dwarf::DW_TAG_compile_unit);
- auto Space = make_unique<DIE>(dwarf::DW_TAG_namespace);
+ auto Space = DIE::get(Alloc, dwarf::DW_TAG_namespace);
DIEInteger One(1);
DIEString SpaceStr = getString("space");
Space->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, SpaceStr);
One);
// sibling?
- auto Foo = make_unique<DIE>(dwarf::DW_TAG_structure_type);
+ auto Foo = DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEString FooStr = getString("foo");
Foo->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
Foo->addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);
// struct { int member; };
TEST_F(DIEHashTest, TypeWithMember) {
- DIE Unnamed(dwarf::DW_TAG_structure_type);
+ DIE &Unnamed = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger Four(4);
Unnamed.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);
- DIE Int(dwarf::DW_TAG_base_type);
+ DIE &Int = *DIE::get(Alloc, dwarf::DW_TAG_base_type);
DIEString IntStr = getString("int");
Int.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, IntStr);
Int.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);
DIEEntry IntRef(Int);
- auto Member = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Member = DIE::get(Alloc, dwarf::DW_TAG_member);
DIEString MemberStr = getString("member");
Member->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemberStr);
DIEInteger Zero(0);
// struct foo { int mem1, mem2; };
TEST_F(DIEHashTest, ReusedType) {
- DIE Unnamed(dwarf::DW_TAG_structure_type);
+ DIE &Unnamed = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger Eight(8);
Unnamed.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
DIEInteger Four(4);
- DIE Int(dwarf::DW_TAG_base_type);
+ DIE &Int = *DIE::get(Alloc, dwarf::DW_TAG_base_type);
DIEString IntStr = getString("int");
Int.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, IntStr);
Int.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);
DIEEntry IntRef(Int);
- auto Mem1 = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Mem1 = DIE::get(Alloc, dwarf::DW_TAG_member);
DIEString Mem1Str = getString("mem1");
Mem1->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, Mem1Str);
DIEInteger Zero(0);
Unnamed.addChild(std::move(Mem1));
- auto Mem2 = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Mem2 = DIE::get(Alloc, dwarf::DW_TAG_member);
DIEString Mem2Str = getString("mem2");
Mem2->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, Mem2Str);
Mem2->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
// struct foo { static foo f; };
TEST_F(DIEHashTest, RecursiveType) {
- DIE Foo(dwarf::DW_TAG_structure_type);
+ DIE &Foo = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger One(1);
Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);
DIEString FooStr = getString("foo");
Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
- auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Mem = DIE::get(Alloc, dwarf::DW_TAG_member);
DIEString MemStr = getString("mem");
Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);
DIEEntry FooRef(Foo);
// struct foo { foo *mem; };
TEST_F(DIEHashTest, Pointer) {
- DIE Foo(dwarf::DW_TAG_structure_type);
+ DIE &Foo = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger Eight(8);
Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
DIEString FooStr = getString("foo");
Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
- auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Mem = DIE::get(Alloc, dwarf::DW_TAG_member);
DIEString MemStr = getString("mem");
Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);
DIEInteger Zero(0);
Mem->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
Zero);
- DIE FooPtr(dwarf::DW_TAG_pointer_type);
+ DIE &FooPtr = *DIE::get(Alloc, dwarf::DW_TAG_pointer_type);
FooPtr.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
DIEEntry FooRef(Foo);
FooPtr.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooRef);
// struct foo { foo &mem; };
TEST_F(DIEHashTest, Reference) {
- DIE Foo(dwarf::DW_TAG_structure_type);
+ DIE &Foo = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger Eight(8);
Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
DIEString FooStr = getString("foo");
Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
- auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Mem = DIE::get(Alloc, dwarf::DW_TAG_member);
DIEString MemStr = getString("mem");
Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);
DIEInteger Zero(0);
Mem->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
Zero);
- DIE FooRef(dwarf::DW_TAG_reference_type);
+ DIE &FooRef = *DIE::get(Alloc, dwarf::DW_TAG_reference_type);
FooRef.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
DIEEntry FooEntry(Foo);
FooRef.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooEntry);
- DIE FooRefConst(dwarf::DW_TAG_const_type);
+ DIE &FooRefConst = *DIE::get(Alloc, dwarf::DW_TAG_const_type);
DIEEntry FooRefRef(FooRef);
FooRefConst.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,
FooRefRef);
// struct foo { foo &&mem; };
TEST_F(DIEHashTest, RValueReference) {
- DIE Foo(dwarf::DW_TAG_structure_type);
+ DIE &Foo = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger Eight(8);
Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
DIEString FooStr = getString("foo");
Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
- auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Mem = DIE::get(Alloc, dwarf::DW_TAG_member);
DIEString MemStr = getString("mem");
Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);
DIEInteger Zero(0);
Mem->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
Zero);
- DIE FooRef(dwarf::DW_TAG_rvalue_reference_type);
+ DIE &FooRef = *DIE::get(Alloc, dwarf::DW_TAG_rvalue_reference_type);
FooRef.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
DIEEntry FooEntry(Foo);
FooRef.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooEntry);
- DIE FooRefConst(dwarf::DW_TAG_const_type);
+ DIE &FooRefConst = *DIE::get(Alloc, dwarf::DW_TAG_const_type);
DIEEntry FooRefRef(FooRef);
FooRefConst.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,
FooRefRef);
// struct foo { foo foo::*mem; };
TEST_F(DIEHashTest, PtrToMember) {
- DIE Foo(dwarf::DW_TAG_structure_type);
+ DIE &Foo = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger Eight(8);
Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
DIEString FooStr = getString("foo");
Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
- auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Mem = DIE::get(Alloc, dwarf::DW_TAG_member);
DIEString MemStr = getString("mem");
Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);
DIEInteger Zero(0);
Mem->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
Zero);
- DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);
+ DIE &PtrToFooMem = *DIE::get(Alloc, dwarf::DW_TAG_ptr_to_member_type);
DIEEntry FooEntry(Foo);
PtrToFooMem.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooEntry);
PtrToFooMem.addValue(Alloc, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,
DIEString MemStr = getString("mem");
uint64_t MD5ResDecl;
{
- DIE Bar(dwarf::DW_TAG_structure_type);
+ DIE &Bar = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
Bar.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, BarStr);
Bar.addValue(Alloc, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present,
One);
- DIE Foo(dwarf::DW_TAG_structure_type);
+ DIE &Foo = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
- auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Mem = DIE::get(Alloc, dwarf::DW_TAG_member);
Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);
Mem->addValue(Alloc, dwarf::DW_AT_data_member_location,
dwarf::DW_FORM_data1, Zero);
- DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);
+ DIE &PtrToFooMem = *DIE::get(Alloc, dwarf::DW_TAG_ptr_to_member_type);
DIEEntry BarEntry(Bar);
PtrToFooMem.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,
BarEntry);
}
uint64_t MD5ResDef;
{
- DIE Bar(dwarf::DW_TAG_structure_type);
+ DIE &Bar = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
Bar.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, BarStr);
Bar.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);
- DIE Foo(dwarf::DW_TAG_structure_type);
+ DIE &Foo = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
- auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Mem = DIE::get(Alloc, dwarf::DW_TAG_member);
Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);
Mem->addValue(Alloc, dwarf::DW_AT_data_member_location,
dwarf::DW_FORM_data1, Zero);
- DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);
+ DIE &PtrToFooMem = *DIE::get(Alloc, dwarf::DW_TAG_ptr_to_member_type);
DIEEntry BarEntry(Bar);
PtrToFooMem.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,
BarEntry);
DIEString MemStr = getString("mem");
uint64_t MD5ResDecl;
{
- DIE Bar(dwarf::DW_TAG_structure_type);
+ DIE &Bar = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
Bar.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, BarStr);
Bar.addValue(Alloc, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present,
One);
- DIE Foo(dwarf::DW_TAG_structure_type);
+ DIE &Foo = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
- auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Mem = DIE::get(Alloc, dwarf::DW_TAG_member);
Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);
Mem->addValue(Alloc, dwarf::DW_AT_data_member_location,
dwarf::DW_FORM_data1, Zero);
- DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);
+ DIE &PtrToFooMem = *DIE::get(Alloc, dwarf::DW_TAG_ptr_to_member_type);
DIEEntry BarEntry(Bar);
PtrToFooMem.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,
BarEntry);
}
uint64_t MD5ResDef;
{
- DIE Bar(dwarf::DW_TAG_structure_type);
+ DIE &Bar = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
Bar.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, BarStr);
Bar.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);
- DIE Foo(dwarf::DW_TAG_structure_type);
+ DIE &Foo = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
- auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Mem = DIE::get(Alloc, dwarf::DW_TAG_member);
Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);
Mem->addValue(Alloc, dwarf::DW_AT_data_member_location,
dwarf::DW_FORM_data1, Zero);
- DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);
+ DIE &PtrToFooMem = *DIE::get(Alloc, dwarf::DW_TAG_ptr_to_member_type);
DIEEntry BarEntry(Bar);
PtrToFooMem.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,
BarEntry);
DIEString FooStr = getString("foo");
DIEString MemStr = getString("mem");
- DIE Unnamed(dwarf::DW_TAG_structure_type);
+ DIE &Unnamed = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
Unnamed.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);
- DIE Foo(dwarf::DW_TAG_structure_type);
+ DIE &Foo = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);
Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
- auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto Mem = DIE::get(Alloc, dwarf::DW_TAG_member);
Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);
Mem->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,
Zero);
- DIE UnnamedPtr(dwarf::DW_TAG_pointer_type);
+ DIE &UnnamedPtr = *DIE::get(Alloc, dwarf::DW_TAG_pointer_type);
UnnamedPtr.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1,
Eight);
DIEEntry UnnamedRef(Unnamed);
// struct { struct foo { }; };
TEST_F(DIEHashTest, NestedType) {
- DIE Unnamed(dwarf::DW_TAG_structure_type);
+ DIE &Unnamed = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger One(1);
Unnamed.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);
- auto Foo = make_unique<DIE>(dwarf::DW_TAG_structure_type);
+ auto Foo = DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEString FooStr = getString("foo");
Foo->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);
Foo->addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);
// struct { static void func(); };
TEST_F(DIEHashTest, MemberFunc) {
- DIE Unnamed(dwarf::DW_TAG_structure_type);
+ DIE &Unnamed = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger One(1);
Unnamed.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);
- auto Func = make_unique<DIE>(dwarf::DW_TAG_subprogram);
+ auto Func = DIE::get(Alloc, dwarf::DW_TAG_subprogram);
DIEString FuncStr = getString("func");
Func->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FuncStr);
// static void func();
// };
TEST_F(DIEHashTest, MemberFuncFlag) {
- DIE A(dwarf::DW_TAG_structure_type);
+ DIE &A = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger One(1);
DIEString AStr = getString("A");
A.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, AStr);
A.addValue(Alloc, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);
A.addValue(Alloc, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, One);
- auto Func = make_unique<DIE>(dwarf::DW_TAG_subprogram);
+ auto Func = DIE::get(Alloc, dwarf::DW_TAG_subprogram);
DIEString FuncStr = getString("func");
DIEString FuncLinkage = getString("_ZN1A4funcEv");
DIEInteger Two(2);
// };
// A a;
TEST_F(DIEHashTest, MemberSdata) {
- DIE A(dwarf::DW_TAG_structure_type);
+ DIE &A = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger One(1);
DIEString AStr = getString("A");
A.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, AStr);
DIEInteger Four(4);
DIEInteger Five(5);
DIEString FStr = getString("int");
- DIE IntTyDIE(dwarf::DW_TAG_base_type);
+ DIE &IntTyDIE = *DIE::get(Alloc, dwarf::DW_TAG_base_type);
IntTyDIE.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);
IntTyDIE.addValue(Alloc, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Five);
IntTyDIE.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FStr);
DIEEntry IntTy(IntTyDIE);
- auto PITyDIE = make_unique<DIE>(dwarf::DW_TAG_const_type);
+ auto PITyDIE = DIE::get(Alloc, dwarf::DW_TAG_const_type);
PITyDIE->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IntTy);
DIEEntry PITy(*PITyDIE);
- auto PI = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto PI = DIE::get(Alloc, dwarf::DW_TAG_member);
DIEString PIStr = getString("PI");
DIEInteger Two(2);
DIEInteger NegThree(-3);
// };
// A a;
TEST_F(DIEHashTest, MemberBlock) {
- DIE A(dwarf::DW_TAG_structure_type);
+ DIE &A = *DIE::get(Alloc, dwarf::DW_TAG_structure_type);
DIEInteger One(1);
DIEString AStr = getString("A");
A.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, AStr);
DIEInteger Four(4);
DIEString FStr = getString("float");
- auto FloatTyDIE = make_unique<DIE>(dwarf::DW_TAG_base_type);
+ auto FloatTyDIE = DIE::get(Alloc, dwarf::DW_TAG_base_type);
FloatTyDIE->addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1,
Four);
FloatTyDIE->addValue(Alloc, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
Four);
FloatTyDIE->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FStr);
-
DIEEntry FloatTy(*FloatTyDIE);
- auto PITyDIE = make_unique<DIE>(dwarf::DW_TAG_const_type);
+ auto PITyDIE = DIE::get(Alloc, dwarf::DW_TAG_const_type);
PITyDIE->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FloatTy);
DIEEntry PITy(*PITyDIE);
- auto PI = make_unique<DIE>(dwarf::DW_TAG_member);
+ auto PI = DIE::get(Alloc, dwarf::DW_TAG_member);
DIEString PIStr = getString("PI");
DIEInteger Two(2);
PI->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, PIStr);