From 24ad5c9e050b6a8798a98f1da2d3473d7650390e Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Sun, 24 May 2015 16:40:47 +0000 Subject: [PATCH] AsmPrinter: Make DIEString small Expose the `DwarfStringPool` entry in a header, and store a pointer to it directly in `DIEString`. Instead of choosing at creation time how to emit it, use the `dwarf::Form` to determine that at emission time. Besides avoiding the other `DIEValue`, this shaves two pointers off of `DIEString`; the data is now a single pointer. This is a nice cleanup on its own -- and drops memory usage from 861 MB down to 853 MB, around 0.9% -- but it's also preparation for passing `DIEValue`s by value. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238117 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/DIE.h | 9 +- lib/CodeGen/AsmPrinter/DIE.cpp | 38 +++++++- lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 29 +----- unittests/CodeGen/DIEHashTest.cpp | 126 +++++++++++++++------------ 4 files changed, 112 insertions(+), 90 deletions(-) diff --git a/include/llvm/CodeGen/DIE.h b/include/llvm/CodeGen/DIE.h index 0f1a5294200..ea7fa2d9131 100644 --- a/include/llvm/CodeGen/DIE.h +++ b/include/llvm/CodeGen/DIE.h @@ -16,6 +16,7 @@ #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/CodeGen/DwarfStringPoolEntry.h" #include "llvm/Support/Dwarf.h" #include @@ -373,15 +374,13 @@ private: class DIEString : public DIEValue { friend class DIEValue; - const DIEValue *Access; - StringRef Str; + DwarfStringPoolEntryRef S; public: - DIEString(const DIEValue *Acc, StringRef S) - : DIEValue(isString), Access(Acc), Str(S) {} + DIEString(DwarfStringPoolEntryRef S) : DIEValue(isString), S(S) {} /// getString - Grab the string out of the object. - StringRef getString() const { return Str; } + StringRef getString() const { return S.getString(); } // Implement isa/cast/dyncast. static bool classof(const DIEValue *D) { return D->getType() == isString; } diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp index c927bad4855..47f2dec018b 100644 --- a/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/lib/CodeGen/AsmPrinter/DIE.cpp @@ -420,19 +420,49 @@ void DIEDelta::printImpl(raw_ostream &O) const { /// EmitValue - Emit string value. /// void DIEString::EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const { - Access->EmitValue(AP, Form); + assert( + (Form == dwarf::DW_FORM_strp || Form == dwarf::DW_FORM_GNU_str_index) && + "Expected valid string form"); + + // Index of string in symbol table. + if (Form == dwarf::DW_FORM_GNU_str_index) { + DIEInteger(S.getIndex()).EmitValue(AP, Form); + return; + } + + // Relocatable symbol. + assert(Form == dwarf::DW_FORM_strp); + if (AP->MAI->doesDwarfUseRelocationsAcrossSections()) { + DIELabel(S.getSymbol()).EmitValue(AP, Form); + return; + } + + // Offset into symbol table. + DIEInteger(S.getOffset()).EmitValue(AP, Form); } /// SizeOf - Determine size of delta value in bytes. /// unsigned DIEString::SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const { - return Access->SizeOf(AP, Form); + assert( + (Form == dwarf::DW_FORM_strp || Form == dwarf::DW_FORM_GNU_str_index) && + "Expected valid string form"); + + // Index of string in symbol table. + if (Form == dwarf::DW_FORM_GNU_str_index) + return DIEInteger(S.getIndex()).SizeOf(AP, Form); + + // Relocatable symbol. + if (AP->MAI->doesDwarfUseRelocationsAcrossSections()) + return DIELabel(S.getSymbol()).SizeOf(AP, Form); + + // Offset into symbol table. + return DIEInteger(S.getOffset()).SizeOf(AP, Form); } #ifndef NDEBUG void DIEString::printImpl(raw_ostream &O) const { - O << "String: " << Str << "\tSymbol: "; - Access->print(O); + O << "String: " << S.getString(); } #endif diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 018d2b9918d..04836c61404 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -223,31 +223,10 @@ void DwarfUnit::addSInt(DIELoc &Die, Optional Form, void DwarfUnit::addString(DIE &Die, dwarf::Attribute Attribute, StringRef String) { - if (!isDwoUnit()) - return addLocalString(Die, Attribute, String); - - addIndexedString(Die, Attribute, String); -} - -void DwarfUnit::addIndexedString(DIE &Die, dwarf::Attribute Attribute, - StringRef String) { - unsigned idx = DU->getStringPool().getIndex(*Asm, String); - DIEValue *Value = new (DIEValueAllocator) DIEInteger(idx); - DIEValue *Str = new (DIEValueAllocator) DIEString(Value, String); - Die.addValue(Attribute, dwarf::DW_FORM_GNU_str_index, Str); -} - -void DwarfUnit::addLocalString(DIE &Die, dwarf::Attribute Attribute, - StringRef String) { - DIEValue *Value; - if (Asm->MAI->doesDwarfUseRelocationsAcrossSections()) - Value = new (DIEValueAllocator) - DIELabel(DU->getStringPool().getSymbol(*Asm, String)); - else - Value = new (DIEValueAllocator) - DIEInteger(DU->getStringPool().getOffset(*Asm, String)); - DIEValue *Str = new (DIEValueAllocator) DIEString(Value, String); - Die.addValue(Attribute, dwarf::DW_FORM_strp, Str); + Die.addValue(Attribute, + isDwoUnit() ? dwarf::DW_FORM_GNU_str_index : dwarf::DW_FORM_strp, + new (DIEValueAllocator) + DIEString(DU->getStringPool().getEntry(*Asm, String))); } void DwarfUnit::addLabel(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form, diff --git a/unittests/CodeGen/DIEHashTest.cpp b/unittests/CodeGen/DIEHashTest.cpp index efb0920b179..c1b11600252 100644 --- a/unittests/CodeGen/DIEHashTest.cpp +++ b/unittests/CodeGen/DIEHashTest.cpp @@ -10,6 +10,7 @@ #include "llvm/CodeGen/DIE.h" #include "../lib/CodeGen/AsmPrinter/DIEHash.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/CodeGen/DwarfStringPoolEntry.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/Format.h" @@ -18,7 +19,20 @@ using namespace llvm; namespace { -TEST(DIEHashTest, Data1) { + +// Test fixture +class DIEHashTest : public testing::Test { + StringMap Pool; + +public: + DIEString getString(StringRef S) { + DwarfStringPoolEntry Entry = {nullptr, 1, 1}; + return DIEString( + DwarfStringPoolEntryRef(*Pool.insert(std::make_pair(S, Entry)).first)); + } +}; + +TEST_F(DIEHashTest, Data1) { DIEHash Hash; DIE Die(dwarf::DW_TAG_base_type); DIEInteger Size(4); @@ -28,7 +42,7 @@ TEST(DIEHashTest, Data1) { } // struct {}; -TEST(DIEHashTest, TrivialType) { +TEST_F(DIEHashTest, TrivialType) { DIE Unnamed(dwarf::DW_TAG_structure_type); DIEInteger One(1); Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One); @@ -43,10 +57,10 @@ TEST(DIEHashTest, TrivialType) { } // struct foo { }; -TEST(DIEHashTest, NamedType) { +TEST_F(DIEHashTest, NamedType) { DIE Foo(dwarf::DW_TAG_structure_type); DIEInteger One(1); - DIEString FooStr(&One, "foo"); + DIEString FooStr = getString("foo"); Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr); Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One); @@ -57,19 +71,19 @@ TEST(DIEHashTest, NamedType) { } // namespace space { struct foo { }; } -TEST(DIEHashTest, NamespacedType) { +TEST_F(DIEHashTest, NamespacedType) { DIE CU(dwarf::DW_TAG_compile_unit); auto Space = make_unique(dwarf::DW_TAG_namespace); DIEInteger One(1); - DIEString SpaceStr(&One, "space"); + DIEString SpaceStr = getString("space"); Space->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &SpaceStr); // DW_AT_declaration is ignored. Space->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, &One); // sibling? auto Foo = make_unique(dwarf::DW_TAG_structure_type); - DIEString FooStr(&One, "foo"); + DIEString FooStr = getString("foo"); Foo->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr); Foo->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One); @@ -84,13 +98,13 @@ TEST(DIEHashTest, NamespacedType) { } // struct { int member; }; -TEST(DIEHashTest, TypeWithMember) { +TEST_F(DIEHashTest, TypeWithMember) { DIE Unnamed(dwarf::DW_TAG_structure_type); DIEInteger Four(4); Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four); DIE Int(dwarf::DW_TAG_base_type); - DIEString IntStr(&Four, "int"); + DIEString IntStr = getString("int"); Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &IntStr); Int.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four); DIEInteger Five(5); @@ -99,7 +113,7 @@ TEST(DIEHashTest, TypeWithMember) { DIEEntry IntRef(Int); auto Member = make_unique(dwarf::DW_TAG_member); - DIEString MemberStr(&Four, "member"); + DIEString MemberStr = getString("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, @@ -114,14 +128,14 @@ TEST(DIEHashTest, TypeWithMember) { } // struct foo { int mem1, mem2; }; -TEST(DIEHashTest, ReusedType) { +TEST_F(DIEHashTest, ReusedType) { DIE Unnamed(dwarf::DW_TAG_structure_type); DIEInteger Eight(8); Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight); DIEInteger Four(4); DIE Int(dwarf::DW_TAG_base_type); - DIEString IntStr(&Four, "int"); + DIEString IntStr = getString("int"); Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &IntStr); Int.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four); DIEInteger Five(5); @@ -130,7 +144,7 @@ TEST(DIEHashTest, ReusedType) { DIEEntry IntRef(Int); auto Mem1 = make_unique(dwarf::DW_TAG_member); - DIEString Mem1Str(&Four, "mem1"); + DIEString Mem1Str = getString("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, @@ -140,7 +154,7 @@ TEST(DIEHashTest, ReusedType) { Unnamed.addChild(std::move(Mem1)); auto Mem2 = make_unique(dwarf::DW_TAG_member); - DIEString Mem2Str(&Four, "mem2"); + DIEString Mem2Str = getString("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); @@ -154,15 +168,15 @@ TEST(DIEHashTest, ReusedType) { } // struct foo { static foo f; }; -TEST(DIEHashTest, RecursiveType) { +TEST_F(DIEHashTest, RecursiveType) { DIE Foo(dwarf::DW_TAG_structure_type); DIEInteger One(1); Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One); - DIEString FooStr(&One, "foo"); + DIEString FooStr = getString("foo"); Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr); auto Mem = make_unique(dwarf::DW_TAG_member); - DIEString MemStr(&One, "mem"); + DIEString MemStr = getString("mem"); Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr); DIEEntry FooRef(Foo); Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRef); @@ -176,15 +190,15 @@ TEST(DIEHashTest, RecursiveType) { } // struct foo { foo *mem; }; -TEST(DIEHashTest, Pointer) { +TEST_F(DIEHashTest, Pointer) { 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"); + DIEString FooStr = getString("foo"); Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr); auto Mem = make_unique(dwarf::DW_TAG_member); - DIEString MemStr(&Eight, "mem"); + DIEString MemStr = getString("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); @@ -205,15 +219,15 @@ TEST(DIEHashTest, Pointer) { } // struct foo { foo &mem; }; -TEST(DIEHashTest, Reference) { +TEST_F(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"); + DIEString FooStr = getString("foo"); Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr); auto Mem = make_unique(dwarf::DW_TAG_member); - DIEString MemStr(&Eight, "mem"); + DIEString MemStr = getString("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); @@ -238,15 +252,15 @@ TEST(DIEHashTest, Reference) { } // struct foo { foo &&mem; }; -TEST(DIEHashTest, RValueReference) { +TEST_F(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"); + DIEString FooStr = getString("foo"); Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr); auto Mem = make_unique(dwarf::DW_TAG_member); - DIEString MemStr(&Eight, "mem"); + DIEString MemStr = getString("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); @@ -271,15 +285,15 @@ TEST(DIEHashTest, RValueReference) { } // struct foo { foo foo::*mem; }; -TEST(DIEHashTest, PtrToMember) { +TEST_F(DIEHashTest, PtrToMember) { 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"); + DIEString FooStr = getString("foo"); Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr); auto Mem = make_unique(dwarf::DW_TAG_member); - DIEString MemStr(&Eight, "mem"); + DIEString MemStr = getString("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); @@ -305,13 +319,13 @@ TEST(DIEHashTest, PtrToMember) { // // struct bar; // { }; // struct foo { bar foo::*mem; }; -TEST(DIEHashTest, PtrToMemberDeclDefMatch) { +TEST_F(DIEHashTest, PtrToMemberDeclDefMatch) { DIEInteger Zero(0); DIEInteger One(1); DIEInteger Eight(8); - DIEString FooStr(&Eight, "foo"); - DIEString BarStr(&Eight, "bar"); - DIEString MemStr(&Eight, "mem"); + DIEString FooStr = getString("foo"); + DIEString BarStr = getString("bar"); + DIEString MemStr = getString("mem"); uint64_t MD5ResDecl; { DIE Bar(dwarf::DW_TAG_structure_type); @@ -378,13 +392,13 @@ TEST(DIEHashTest, PtrToMemberDeclDefMatch) { // // struct bar; // { }; // struct foo { bar bar::*mem; }; -TEST(DIEHashTest, PtrToMemberDeclDefMisMatch) { +TEST_F(DIEHashTest, PtrToMemberDeclDefMisMatch) { DIEInteger Zero(0); DIEInteger One(1); DIEInteger Eight(8); - DIEString FooStr(&Eight, "foo"); - DIEString BarStr(&Eight, "bar"); - DIEString MemStr(&Eight, "mem"); + DIEString FooStr = getString("foo"); + DIEString BarStr = getString("bar"); + DIEString MemStr = getString("mem"); uint64_t MD5ResDecl; { DIE Bar(dwarf::DW_TAG_structure_type); @@ -451,12 +465,12 @@ TEST(DIEHashTest, PtrToMemberDeclDefMisMatch) { // struct { } a; // struct foo { decltype(a) mem; }; -TEST(DIEHashTest, RefUnnamedType) { +TEST_F(DIEHashTest, RefUnnamedType) { DIEInteger Zero(0); DIEInteger One(1); DIEInteger Eight(8); - DIEString FooStr(&Zero, "foo"); - DIEString MemStr(&Zero, "mem"); + DIEString FooStr = getString("foo"); + DIEString MemStr = getString("mem"); DIE Unnamed(dwarf::DW_TAG_structure_type); Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One); @@ -485,13 +499,13 @@ TEST(DIEHashTest, RefUnnamedType) { } // struct { struct foo { }; }; -TEST(DIEHashTest, NestedType) { +TEST_F(DIEHashTest, NestedType) { DIE Unnamed(dwarf::DW_TAG_structure_type); DIEInteger One(1); Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One); auto Foo = make_unique(dwarf::DW_TAG_structure_type); - DIEString FooStr(&One, "foo"); + DIEString FooStr = getString("foo"); Foo->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr); Foo->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One); @@ -504,13 +518,13 @@ TEST(DIEHashTest, NestedType) { } // struct { static void func(); }; -TEST(DIEHashTest, MemberFunc) { +TEST_F(DIEHashTest, MemberFunc) { DIE Unnamed(dwarf::DW_TAG_structure_type); DIEInteger One(1); Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One); auto Func = make_unique(dwarf::DW_TAG_subprogram); - DIEString FuncStr(&One, "func"); + DIEString FuncStr = getString("func"); Func->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FuncStr); Unnamed.addChild(std::move(Func)); @@ -524,18 +538,18 @@ TEST(DIEHashTest, MemberFunc) { // struct A { // static void func(); // }; -TEST(DIEHashTest, MemberFuncFlag) { +TEST_F(DIEHashTest, MemberFuncFlag) { DIE A(dwarf::DW_TAG_structure_type); DIEInteger One(1); - DIEString AStr(&One, "A"); + DIEString AStr = getString("A"); A.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &AStr); A.addValue(dwarf::DW_AT_byte_size, 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); auto Func = make_unique(dwarf::DW_TAG_subprogram); - DIEString FuncStr(&One, "func"); - DIEString FuncLinkage(&One, "_ZN1A4funcEv"); + DIEString FuncStr = getString("func"); + DIEString FuncLinkage = getString("_ZN1A4funcEv"); DIEInteger Two(2); Func->addValue(dwarf::DW_AT_external, dwarf::DW_FORM_flag_present, &One); Func->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FuncStr); @@ -557,10 +571,10 @@ TEST(DIEHashTest, MemberFuncFlag) { // const static int PI = -3; // }; // A a; -TEST(DIEHashTest, MemberSdata) { +TEST_F(DIEHashTest, MemberSdata) { DIE A(dwarf::DW_TAG_structure_type); DIEInteger One(1); - DIEString AStr(&One, "A"); + DIEString AStr = getString("A"); A.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &AStr); A.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One); A.addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, &One); @@ -568,7 +582,7 @@ TEST(DIEHashTest, MemberSdata) { DIEInteger Four(4); DIEInteger Five(5); - DIEString FStr(&One, "int"); + DIEString FStr = getString("int"); DIE IntTyDIE(dwarf::DW_TAG_base_type); IntTyDIE.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four); IntTyDIE.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Five); @@ -580,7 +594,7 @@ TEST(DIEHashTest, MemberSdata) { DIEEntry PITy(*PITyDIE); auto PI = make_unique(dwarf::DW_TAG_member); - DIEString PIStr(&One, "PI"); + DIEString PIStr = getString("PI"); DIEInteger Two(2); DIEInteger NegThree(-3); PI->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &PIStr); @@ -602,17 +616,17 @@ TEST(DIEHashTest, MemberSdata) { // const static float PI = 3.14; // }; // A a; -TEST(DIEHashTest, MemberBlock) { +TEST_F(DIEHashTest, MemberBlock) { DIE A(dwarf::DW_TAG_structure_type); DIEInteger One(1); - DIEString AStr(&One, "A"); + DIEString AStr = getString("A"); A.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &AStr); A.addValue(dwarf::DW_AT_byte_size, 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); DIEInteger Four(4); - DIEString FStr(&One, "float"); + DIEString FStr = getString("float"); auto FloatTyDIE = make_unique(dwarf::DW_TAG_base_type); FloatTyDIE->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four); FloatTyDIE->addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Four); @@ -624,7 +638,7 @@ TEST(DIEHashTest, MemberBlock) { DIEEntry PITy(*PITyDIE); auto PI = make_unique(dwarf::DW_TAG_member); - DIEString PIStr(&One, "PI"); + DIEString PIStr = getString("PI"); DIEInteger Two(2); PI->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &PIStr); PI->addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, &One);