<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 25, 2015 at 4:46 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: dexonsmith<br>
Date: Thu Jun 25 18:46:41 2015<br>
New Revision: 240733<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D240733-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hfyEVDYYRbyqBsqZCELui7T6Biv933KCYyOMbo_a3nI&s=vk9CDK7Jxbvh3I4nbbRMM78OUth2gKy89l9pRbbOUXM&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=240733&view=rev</a><br>
Log:<br>
AsmPrinter: Convert DIE::Values to a linked list<br>
<br>
Change `DIE::Values` to a singly linked list, where each node is<br>
allocated on a `BumpPtrAllocator`. In order to support `push_back()`,<br>
the list is circular, and points at the tail element instead of the<br>
head. I abstracted the core list logic out to `IntrusiveBackList` so<br>
that it can be reused for `DIE::Children`, which also cares about<br>
`push_back()`.<br>
<br>
This drops llc memory usage from 799 MB down to 735 MB, about 8%.<br></blockquote><div><br>Just looking at the core of this change - where exactly are the memory savings:<br><br><span style="font-size:12.8000001907349px">- SmallVector<DIEValue, 12> Values;</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">+ DIEValueList Values;<br></span><br>Is it just that most DIEs don't have that many values? If we had a lower small vector size I would imagine it'd be smaller than a linked list - paying a pointer in every value compared to paying one pointer and one size to point to all the values? (with any DIE with more than two values that would be efficient - more than 3 and we could have buffer pointer + size + capacity and still be winning, no?) Do most DIEs have fewer attributes? Most I can think of have more than 3... <br><br>Presumably I've missed something about how this is a win over alternatives.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;<br>
see r236629 for details.)<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/ADT/iterator.h<br>
llvm/trunk/include/llvm/CodeGen/DIE.h<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h<br>
llvm/trunk/tools/dsymutil/DwarfLinker.cpp<br>
llvm/trunk/unittests/CodeGen/DIEHashTest.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/ADT/iterator.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_ADT_iterator.h-3Frev-3D240733-26r1-3D240732-26r2-3D240733-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hfyEVDYYRbyqBsqZCELui7T6Biv933KCYyOMbo_a3nI&s=ZyRapLWyLoJnJAmjxdowzVUTp7NVv0LTmqqBwoEgryM&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/iterator.h?rev=240733&r1=240732&r2=240733&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/ADT/iterator.h (original)<br>
+++ llvm/trunk/include/llvm/ADT/iterator.h Thu Jun 25 18:46:41 2015<br>
@@ -162,6 +162,8 @@ protected:<br>
int>::type = 0)<br>
: I(std::forward<U &&>(u)) {}<br>
<br>
+ const WrappedIteratorT &wrapped() const { return I; }<br>
+<br>
public:<br>
typedef DifferenceTypeT difference_type;<br>
<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/DIE.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_CodeGen_DIE.h-3Frev-3D240733-26r1-3D240732-26r2-3D240733-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hfyEVDYYRbyqBsqZCELui7T6Biv933KCYyOMbo_a3nI&s=QhK8VGFaAM3d1o-Xlyk_wnQUprZEykNqqbxYj76ZjEY&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DIE.h?rev=240733&r1=240732&r2=240733&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/DIE.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/DIE.h Thu Jun 25 18:46:41 2015<br>
@@ -15,6 +15,8 @@<br>
#define LLVM_LIB_CODEGEN_ASMPRINTER_DIE_H<br>
<br>
#include "llvm/ADT/FoldingSet.h"<br>
+#include "llvm/ADT/PointerIntPair.h"<br>
+#include "llvm/ADT/STLExtras.h"<br>
#include "llvm/ADT/SmallVector.h"<br>
#include "llvm/CodeGen/DwarfStringPoolEntry.h"<br>
#include "llvm/Support/Dwarf.h"<br>
@@ -448,6 +450,162 @@ public:<br>
#endif<br>
};<br>
<br>
+struct IntrusiveBackListNode {<br>
+ PointerIntPair<IntrusiveBackListNode *, 1> Next;<br>
+ IntrusiveBackListNode() : Next(this, true) {}<br>
+<br>
+ IntrusiveBackListNode *getNext() const {<br>
+ return Next.getInt() ? nullptr : Next.getPointer();<br>
+ }<br>
+};<br>
+<br>
+struct IntrusiveBackListBase {<br>
+ typedef IntrusiveBackListNode Node;<br>
+ Node *Last = nullptr;<br>
+<br>
+ bool empty() const { return !Last; }<br>
+ void push_back(Node &N) {<br>
+ assert(N.Next.getPointer() == &N && "Expected unlinked node");<br>
+ assert(N.Next.getInt() == true && "Expected unlinked node");<br>
+<br>
+ if (Last) {<br>
+ N.Next = Last->Next;<br>
+ Last->Next.setPointerAndInt(&N, false);<br>
+ }<br>
+ Last = &N;<br>
+ }<br>
+};<br>
+<br>
+template <class T> class IntrusiveBackList : IntrusiveBackListBase {<br>
+public:<br>
+ using IntrusiveBackListBase::empty;<br>
+ void push_back(T &N) { IntrusiveBackListBase::push_back(N); }<br>
+ T &back() { return *static_cast<T *>(Last); }<br>
+ const T &back() const { return *static_cast<T *>(Last); }<br>
+<br>
+ class const_iterator;<br>
+ class iterator<br>
+ : public iterator_facade_base<iterator, std::forward_iterator_tag, T> {<br>
+ friend class const_iterator;<br>
+ Node *N = nullptr;<br>
+<br>
+ public:<br>
+ iterator() = default;<br>
+ explicit iterator(T *N) : N(N) {}<br>
+<br>
+ iterator &operator++() {<br>
+ N = N->getNext();<br>
+ return *this;<br>
+ }<br>
+<br>
+ explicit operator bool() const { return N; }<br>
+ T &operator*() const { return *static_cast<T *>(N); }<br>
+<br>
+ bool operator==(const iterator &X) const { return N == X.N; }<br>
+ bool operator!=(const iterator &X) const { return N != X.N; }<br>
+ };<br>
+<br>
+ class const_iterator<br>
+ : public iterator_facade_base<const_iterator, std::forward_iterator_tag,<br>
+ const T> {<br>
+ const Node *N = nullptr;<br>
+<br>
+ public:<br>
+ const_iterator() = default;<br>
+ const_iterator(iterator X) : N(X.N) {}<br>
+ explicit const_iterator(const T *N) : N(N) {}<br>
+<br>
+ const_iterator &operator++() {<br>
+ N = N->getNext();<br>
+ return *this;<br>
+ }<br>
+<br>
+ explicit operator bool() const { return N; }<br>
+ const T &operator*() const { return *static_cast<const T *>(N); }<br>
+<br>
+ bool operator==(const const_iterator &X) const { return N == X.N; }<br>
+ bool operator!=(const const_iterator &X) const { return N != X.N; }<br>
+ };<br>
+<br>
+ iterator begin() {<br>
+ return Last ? iterator(static_cast<T *>(Last->Next.getPointer())) : end();<br>
+ }<br>
+ const_iterator begin() const {<br>
+ return const_cast<IntrusiveBackList *>(this)->begin();<br>
+ }<br>
+ iterator end() { return iterator(); }<br>
+ const_iterator end() const { return const_iterator(); }<br>
+<br>
+ static iterator toIterator(T &N) { return iterator(&N); }<br>
+ static const_iterator toIterator(const T &N) { return const_iterator(&N); }<br>
+};<br>
+<br>
+/// A list of DIE values.<br>
+///<br>
+/// This is a singly-linked list, but instead of reversing the order of<br>
+/// insertion, we keep a pointer to the back of the list so we can push in<br>
+/// order.<br>
+class DIEValueList {<br>
+ struct Node : IntrusiveBackListNode {<br>
+ DIEValue V;<br>
+ explicit Node(DIEValue V) : V(V) {}<br>
+ };<br>
+<br>
+ typedef IntrusiveBackList<Node> ListTy;<br>
+ ListTy List;<br>
+<br>
+public:<br>
+ bool empty() const { return List.empty(); }<br>
+<br>
+ class const_iterator;<br>
+ class iterator<br>
+ : public iterator_adaptor_base<iterator, ListTy::iterator,<br>
+ std::forward_iterator_tag, DIEValue> {<br>
+ friend class const_iterator;<br>
+ typedef iterator_adaptor_base<iterator, ListTy::iterator,<br>
+ std::forward_iterator_tag,<br>
+ DIEValue> iterator_adaptor;<br>
+<br>
+ public:<br>
+ iterator() = default;<br>
+ explicit iterator(ListTy::iterator X) : iterator_adaptor(X) {}<br>
+<br>
+ explicit operator bool() const { return bool(wrapped()); }<br>
+ DIEValue &operator*() const { return wrapped()->V; }<br>
+ };<br>
+<br>
+ class const_iterator<br>
+ : public iterator_adaptor_base<const_iterator, ListTy::const_iterator,<br>
+ std::forward_iterator_tag,<br>
+ const DIEValue> {<br>
+ typedef iterator_adaptor_base<const_iterator, ListTy::const_iterator,<br>
+ std::forward_iterator_tag,<br>
+ const DIEValue> iterator_adaptor;<br>
+<br>
+ public:<br>
+ const_iterator() = default;<br>
+ const_iterator(DIEValueList::iterator X) : iterator_adaptor(X.wrapped()) {}<br>
+ explicit const_iterator(ListTy::const_iterator X) : iterator_adaptor(X) {}<br>
+<br>
+ explicit operator bool() const { return bool(wrapped()); }<br>
+ const DIEValue &operator*() const { return wrapped()->V; }<br>
+ };<br>
+<br>
+ iterator insert(BumpPtrAllocator &Alloc, DIEValue V) {<br>
+ List.push_back(*new (Alloc) Node(V));<br>
+ return iterator(ListTy::toIterator(List.back()));<br>
+ }<br>
+ template <class... Ts><br>
+ iterator emplace(BumpPtrAllocator &Alloc, Ts &&... Args) {<br>
+ return insert(Alloc, DIEValue(std::forward<Ts>(Args)...));<br>
+ }<br>
+<br>
+ iterator begin() { return iterator(List.begin()); }<br>
+ iterator end() { return iterator(List.end()); }<br>
+ const_iterator begin() const { return const_iterator(List.begin()); }<br>
+ const_iterator end() const { return const_iterator(List.end()); }<br>
+};<br>
+<br>
//===--------------------------------------------------------------------===//<br>
/// DIE - A structured debug information entry. Has an abbreviation which<br>
/// describes its organization.<br>
@@ -481,7 +639,7 @@ protected:<br>
<br>
/// Attribute values.<br>
///<br>
- SmallVector<DIEValue, 12> Values;<br>
+ DIEValueList Values;<br>
<br>
protected:<br>
DIE() : Offset(0), Size(0), Parent(nullptr) {}<br>
@@ -504,19 +662,20 @@ public:<br>
return llvm::make_range(Children.begin(), Children.end());<br>
}<br>
<br>
- typedef SmallVectorImpl<DIEValue>::const_iterator value_iterator;<br>
+ typedef DIEValueList::iterator value_iterator;<br>
typedef iterator_range<value_iterator> value_range;<br>
<br>
- value_iterator values_begin() const { return Values.begin(); }<br>
- value_iterator values_end() const { return Values.end(); }<br>
- value_range values() const {<br>
- return llvm::make_range(values_begin(), values_end());<br>
+ value_range values() {<br>
+ return llvm::make_range(Values.begin(), Values.end());<br>
}<br>
<br>
- void setValue(unsigned I, DIEValue New) {<br>
- assert(I < Values.size());<br>
- Values[I] = New;<br>
+ typedef DIEValueList::const_iterator const_value_iterator;<br>
+ typedef iterator_range<const_value_iterator> const_value_range;<br>
+<br>
+ const_value_range values() const {<br>
+ return llvm::make_range(Values.begin(), Values.end());<br>
}<br>
+<br>
DIE *getParent() const { return Parent; }<br>
<br>
/// Generate the abbreviation for this DIE.<br>
@@ -539,10 +698,13 @@ public:<br>
<br>
/// addValue - Add a value and attributes to a DIE.<br>
///<br>
- void addValue(DIEValue Value) { Values.push_back(Value); }<br>
+ value_iterator addValue(BumpPtrAllocator &Alloc, DIEValue Value) {<br>
+ return Values.insert(Alloc, Value);<br>
+ }<br>
template <class T><br>
- void addValue(dwarf::Attribute Attribute, dwarf::Form Form, T &&Value) {<br>
- Values.emplace_back(Attribute, Form, std::forward<T>(Value));<br>
+ value_iterator addValue(BumpPtrAllocator &Alloc, dwarf::Attribute Attribute,<br>
+ dwarf::Form Form, T &&Value) {<br>
+ return Values.emplace(Alloc, Attribute, Form, std::forward<T>(Value));<br>
}<br>
<br>
/// addChild - Add a child to the DIE.<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DIE.cpp-3Frev-3D240733-26r1-3D240732-26r2-3D240733-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hfyEVDYYRbyqBsqZCELui7T6Biv933KCYyOMbo_a3nI&s=MYqnb7nEsPnywH-JwNJ7tsOxYF3mcVTAolfeiN9pSBA&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=240733&r1=240732&r2=240733&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Thu Jun 25 18:46:41 2015<br>
@@ -165,18 +165,17 @@ void DIE::print(raw_ostream &O, unsigned<br>
}<br>
<br>
IndentCount += 2;<br>
- for (unsigned i = 0, N = Values.size(); i < N; ++i) {<br>
+ unsigned I = 0;<br>
+ for (const auto &V : Values) {<br>
O << Indent;<br>
<br>
if (!isBlock)<br>
- O << dwarf::AttributeString(Values[i].getAttribute());<br>
+ O << dwarf::AttributeString(V.getAttribute());<br>
else<br>
- O << "Blk[" << i << "]";<br>
+ O << "Blk[" << I++ << "]";<br>
<br>
- O << " "<br>
- << dwarf::FormEncodingString(Values[i].getForm())<br>
- << " ";<br>
- Values[i].print(O);<br>
+ O << " " << dwarf::FormEncodingString(V.getForm()) << " ";<br>
+ V.print(O);<br>
O << "\n";<br>
}<br>
IndentCount -= 2;<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DIEHash.cpp-3Frev-3D240733-26r1-3D240732-26r2-3D240733-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hfyEVDYYRbyqBsqZCELui7T6Biv933KCYyOMbo_a3nI&s=e2tCU38IE9wlSqv7SbbIIAR_NV_88v2meBnUYpRoUMs&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp?rev=240733&r1=240732&r2=240733&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp Thu Jun 25 18:46:41 2015<br>
@@ -263,7 +263,7 @@ void DIEHash::hashDIEEntry(dwarf::Attrib<br>
<br>
// Hash all of the values in a block like set of values. This assumes that<br>
// all of the data is going to be added as integers.<br>
-void DIEHash::hashBlockData(const DIE::value_range &Values) {<br>
+void DIEHash::hashBlockData(const DIE::const_value_range &Values) {<br>
for (const auto &V : Values)<br>
Hash.update((uint64_t)V.getDIEInteger().getValue());<br>
}<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DIEHash.h-3Frev-3D240733-26r1-3D240732-26r2-3D240733-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hfyEVDYYRbyqBsqZCELui7T6Biv933KCYyOMbo_a3nI&s=XO1yep1De6sC9FHdqjodiK5xb6vQtfzpQm0MZdtDOnA&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h?rev=240733&r1=240732&r2=240733&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h Thu Jun 25 18:46:41 2015<br>
@@ -128,7 +128,7 @@ private:<br>
<br>
/// \brief Hashes the data in a block like DIEValue, e.g. DW_FORM_block or<br>
/// DW_FORM_exprloc.<br>
- void hashBlockData(const DIE::value_range &Values);<br>
+ void hashBlockData(const DIE::const_value_range &Values);<br>
<br>
/// \brief Hashes the contents pointed to in the .debug_loc section.<br>
void hashLocList(const DIELocList &LocList);<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DwarfCompileUnit.cpp-3Frev-3D240733-26r1-3D240732-26r2-3D240733-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hfyEVDYYRbyqBsqZCELui7T6Biv933KCYyOMbo_a3nI&s=Mn7CDvPTw5dWq1tXAk55fXu7-bU8Q9ruEi17OuQxcRY&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=240733&r1=240732&r2=240733&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Thu Jun 25 18:46:41 2015<br>
@@ -42,7 +42,8 @@ void DwarfCompileUnit::addLabelAddress(D<br>
DD->addArangeLabel(SymbolCU(this, Label));<br>
<br>
unsigned idx = DD->getAddressPool().getIndex(Label);<br>
- Die.addValue(Attribute, dwarf::DW_FORM_GNU_addr_index, DIEInteger(idx));<br>
+ Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_GNU_addr_index,<br>
+ DIEInteger(idx));<br>
}<br>
<br>
void DwarfCompileUnit::addLocalLabelAddress(DIE &Die,<br>
@@ -52,9 +53,11 @@ void DwarfCompileUnit::addLocalLabelAddr<br>
DD->addArangeLabel(SymbolCU(this, Label));<br>
<br>
if (Label)<br>
- Die.addValue(Attribute, dwarf::DW_FORM_addr, DIELabel(Label));<br>
+ Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_addr,<br>
+ DIELabel(Label));<br>
else<br>
- Die.addValue(Attribute, dwarf::DW_FORM_addr, DIEInteger(0));<br>
+ Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_addr,<br>
+ DIEInteger(0));<br>
}<br>
<br>
unsigned DwarfCompileUnit::getOrCreateSourceID(StringRef FileName,<br>
@@ -225,16 +228,15 @@ void DwarfCompileUnit::addRange(RangeSpa<br>
CURanges.back().setEnd(Range.getEnd());<br>
}<br>
<br>
-void DwarfCompileUnit::addSectionLabel(DIE &Die, dwarf::Attribute Attribute,<br>
- const MCSymbol *Label,<br>
- const MCSymbol *Sec) {<br>
+DIE::value_iterator<br>
+DwarfCompileUnit::addSectionLabel(DIE &Die, dwarf::Attribute Attribute,<br>
+ const MCSymbol *Label, const MCSymbol *Sec) {<br>
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())<br>
- addLabel(Die, Attribute,<br>
- DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset<br>
- : dwarf::DW_FORM_data4,<br>
- Label);<br>
- else<br>
- addSectionDelta(Die, Attribute, Label, Sec);<br>
+ return addLabel(Die, Attribute,<br>
+ DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset<br>
+ : dwarf::DW_FORM_data4,<br>
+ Label);<br>
+ return addSectionDelta(Die, Attribute, Label, Sec);<br>
}<br>
<br>
void DwarfCompileUnit::initStmtList() {<br>
@@ -242,20 +244,19 @@ void DwarfCompileUnit::initStmtList() {<br>
MCSymbol *LineTableStartSym =<br>
Asm->OutStreamer->getDwarfLineTableSymbol(getUniqueID());<br>
<br>
- stmtListIndex = std::distance(UnitDie.values_begin(), UnitDie.values_end());<br>
-<br>
// DW_AT_stmt_list is a offset of line number information for this<br>
// compile unit in debug_line section. For split dwarf this is<br>
// left in the skeleton CU and so not included.<br>
// The line table entries are not always emitted in assembly, so it<br>
// is not okay to use line_table_start here.<br>
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();<br>
- addSectionLabel(UnitDie, dwarf::DW_AT_stmt_list, LineTableStartSym,<br>
- TLOF.getDwarfLineSection()->getBeginSymbol());<br>
+ StmtListValue =<br>
+ addSectionLabel(UnitDie, dwarf::DW_AT_stmt_list, LineTableStartSym,<br>
+ TLOF.getDwarfLineSection()->getBeginSymbol());<br>
}<br>
<br>
void DwarfCompileUnit::applyStmtList(DIE &D) {<br>
- D.addValue(UnitDie.values_begin()[stmtListIndex]);<br>
+ D.addValue(DIEValueAllocator, *StmtListValue);<br>
}<br>
<br>
void DwarfCompileUnit::attachLowHighPC(DIE &D, const MCSymbol *Begin,<br>
@@ -361,11 +362,13 @@ void DwarfCompileUnit::constructScopeDIE<br>
FinalChildren.push_back(std::move(ScopeDIE));<br>
}<br>
<br>
-void DwarfCompileUnit::addSectionDelta(DIE &Die, dwarf::Attribute Attribute,<br>
- const MCSymbol *Hi, const MCSymbol *Lo) {<br>
- Die.addValue(Attribute, DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset<br>
- : dwarf::DW_FORM_data4,<br>
- new (DIEValueAllocator) DIEDelta(Hi, Lo));<br>
+DIE::value_iterator<br>
+DwarfCompileUnit::addSectionDelta(DIE &Die, dwarf::Attribute Attribute,<br>
+ const MCSymbol *Hi, const MCSymbol *Lo) {<br>
+ return Die.addValue(DIEValueAllocator, Attribute,<br>
+ DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset<br>
+ : dwarf::DW_FORM_data4,<br>
+ new (DIEValueAllocator) DIEDelta(Hi, Lo));<br>
}<br>
<br>
void DwarfCompileUnit::addScopeRangeList(DIE &ScopeDIE,<br>
@@ -781,7 +784,7 @@ void DwarfCompileUnit::addLocationList(D<br>
unsigned Index) {<br>
dwarf::Form Form = DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset<br>
: dwarf::DW_FORM_data4;<br>
- Die.addValue(Attribute, Form, DIELocList(Index));<br>
+ Die.addValue(DIEValueAllocator, Attribute, Form, DIELocList(Index));<br>
}<br>
<br>
void DwarfCompileUnit::applyVariableAttributes(const DbgVariable &Var,<br>
@@ -798,7 +801,7 @@ void DwarfCompileUnit::applyVariableAttr<br>
/// Add a Dwarf expression attribute data and value.<br>
void DwarfCompileUnit::addExpr(DIELoc &Die, dwarf::Form Form,<br>
const MCExpr *Expr) {<br>
- Die.addValue((dwarf::Attribute)0, Form, DIEExpr(Expr));<br>
+ Die.addValue(DIEValueAllocator, (dwarf::Attribute)0, Form, DIEExpr(Expr));<br>
}<br>
<br>
void DwarfCompileUnit::applySubprogramAttributesToDefinition(<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DwarfCompileUnit.h-3Frev-3D240733-26r1-3D240732-26r2-3D240733-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hfyEVDYYRbyqBsqZCELui7T6Biv933KCYyOMbo_a3nI&s=UoTqtwnJXbEyZdWRuKZd2GSLoCdl7XBlrGYSFcQse1I&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=240733&r1=240732&r2=240733&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Thu Jun 25 18:46:41 2015<br>
@@ -31,7 +31,7 @@ class LexicalScope;<br>
class DwarfCompileUnit : public DwarfUnit {<br>
/// The attribute index of DW_AT_stmt_list in the compile unit DIE, avoiding<br>
/// the need to search for it in applyStmtList.<br>
- unsigned stmtListIndex;<br>
+ DIE::value_iterator StmtListValue;<br>
<br>
/// Skeleton unit associated with this unit.<br>
DwarfCompileUnit *Skeleton;<br>
@@ -92,8 +92,8 @@ public:<br>
const MCSymbol *Label);<br>
<br>
/// addSectionDelta - Add a label delta attribute data and value.<br>
- void addSectionDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi,<br>
- const MCSymbol *Lo);<br>
+ DIE::value_iterator addSectionDelta(DIE &Die, dwarf::Attribute Attribute,<br>
+ const MCSymbol *Hi, const MCSymbol *Lo);<br>
<br>
DwarfCompileUnit &getCU() override { return *this; }<br>
<br>
@@ -106,8 +106,9 @@ public:<br>
<br>
/// addSectionLabel - Add a Dwarf section label attribute data and value.<br>
///<br>
- void addSectionLabel(DIE &Die, dwarf::Attribute Attribute,<br>
- const MCSymbol *Label, const MCSymbol *Sec);<br>
+ DIE::value_iterator addSectionLabel(DIE &Die, dwarf::Attribute Attribute,<br>
+ const MCSymbol *Label,<br>
+ const MCSymbol *Sec);<br>
<br>
/// \brief Find DIE for the given subprogram and attach appropriate<br>
/// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DwarfUnit.cpp-3Frev-3D240733-26r1-3D240732-26r2-3D240733-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hfyEVDYYRbyqBsqZCELui7T6Biv933KCYyOMbo_a3nI&s=856cViABjtmDWWWsqI8dBbMEe7AylBxLbuEdk70mnh0&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=240733&r1=240732&r2=240733&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Thu Jun 25 18:46:41 2015<br>
@@ -184,16 +184,18 @@ void DwarfUnit::insertDIE(const DINode *<br>
<br>
void DwarfUnit::addFlag(DIE &Die, dwarf::Attribute Attribute) {<br>
if (DD->getDwarfVersion() >= 4)<br>
- Die.addValue(Attribute, dwarf::DW_FORM_flag_present, DIEInteger(1));<br>
+ Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_flag_present,<br>
+ DIEInteger(1));<br>
else<br>
- Die.addValue(Attribute, dwarf::DW_FORM_flag, DIEInteger(1));<br>
+ Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_flag,<br>
+ DIEInteger(1));<br>
}<br>
<br>
void DwarfUnit::addUInt(DIE &Die, dwarf::Attribute Attribute,<br>
Optional<dwarf::Form> Form, uint64_t Integer) {<br>
if (!Form)<br>
Form = DIEInteger::BestForm(false, Integer);<br>
- Die.addValue(Attribute, *Form, DIEInteger(Integer));<br>
+ Die.addValue(DIEValueAllocator, Attribute, *Form, DIEInteger(Integer));<br>
}<br>
<br>
void DwarfUnit::addUInt(DIE &Block, dwarf::Form Form, uint64_t Integer) {<br>
@@ -204,7 +206,7 @@ void DwarfUnit::addSInt(DIE &Die, dwarf:<br>
Optional<dwarf::Form> Form, int64_t Integer) {<br>
if (!Form)<br>
Form = DIEInteger::BestForm(true, Integer);<br>
- Die.addValue(Attribute, *Form, DIEInteger(Integer));<br>
+ Die.addValue(DIEValueAllocator, Attribute, *Form, DIEInteger(Integer));<br>
}<br>
<br>
void DwarfUnit::addSInt(DIELoc &Die, Optional<dwarf::Form> Form,<br>
@@ -214,14 +216,15 @@ void DwarfUnit::addSInt(DIELoc &Die, Opt<br>
<br>
void DwarfUnit::addString(DIE &Die, dwarf::Attribute Attribute,<br>
StringRef String) {<br>
- Die.addValue(Attribute,<br>
+ Die.addValue(DIEValueAllocator, Attribute,<br>
isDwoUnit() ? dwarf::DW_FORM_GNU_str_index : dwarf::DW_FORM_strp,<br>
DIEString(DU->getStringPool().getEntry(*Asm, String)));<br>
}<br>
<br>
-void DwarfUnit::addLabel(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form,<br>
- const MCSymbol *Label) {<br>
- Die.addValue(Attribute, Form, DIELabel(Label));<br>
+DIE::value_iterator DwarfUnit::addLabel(DIE &Die, dwarf::Attribute Attribute,<br>
+ dwarf::Form Form,<br>
+ const MCSymbol *Label) {<br>
+ return Die.addValue(DIEValueAllocator, Attribute, Form, DIELabel(Label));<br>
}<br>
<br>
void DwarfUnit::addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label) {<br>
@@ -254,7 +257,7 @@ void DwarfUnit::addOpAddress(DIELoc &Die<br>
<br>
void DwarfUnit::addLabelDelta(DIE &Die, dwarf::Attribute Attribute,<br>
const MCSymbol *Hi, const MCSymbol *Lo) {<br>
- Die.addValue(Attribute, dwarf::DW_FORM_data4,<br>
+ Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_data4,<br>
new (DIEValueAllocator) DIEDelta(Hi, Lo));<br>
}<br>
<br>
@@ -269,8 +272,8 @@ void DwarfUnit::addDIETypeSignature(DIE<br>
// and think this is a full definition.<br>
addFlag(Die, dwarf::DW_AT_declaration);<br>
<br>
- Die.addValue(dwarf::DW_AT_signature, dwarf::DW_FORM_ref_sig8,<br>
- DIETypeSignature(Type));<br>
+ Die.addValue(DIEValueAllocator, dwarf::DW_AT_signature,<br>
+ dwarf::DW_FORM_ref_sig8, DIETypeSignature(Type));<br>
}<br>
<br>
void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute,<br>
@@ -282,7 +285,7 @@ void DwarfUnit::addDIEEntry(DIE &Die, dw<br>
DieCU = &getUnitDie();<br>
if (!EntryCU)<br>
EntryCU = &getUnitDie();<br>
- Die.addValue(Attribute,<br>
+ Die.addValue(DIEValueAllocator, Attribute,<br>
EntryCU == DieCU ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr,<br>
Entry);<br>
}<br>
@@ -299,14 +302,15 @@ DIE &DwarfUnit::createAndAddDIE(unsigned<br>
void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc) {<br>
Loc->ComputeSize(Asm);<br>
DIELocs.push_back(Loc); // Memoize so we can call the destructor later on.<br>
- Die.addValue(Attribute, Loc->BestForm(DD->getDwarfVersion()), Loc);<br>
+ Die.addValue(DIEValueAllocator, Attribute,<br>
+ Loc->BestForm(DD->getDwarfVersion()), Loc);<br>
}<br>
<br>
void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute,<br>
DIEBlock *Block) {<br>
Block->ComputeSize(Asm);<br>
DIEBlocks.push_back(Block); // Memoize so we can call the destructor later on.<br>
- Die.addValue(Attribute, Block->BestForm(), Block);<br>
+ Die.addValue(DIEValueAllocator, Attribute, Block->BestForm(), Block);<br>
}<br>
<br>
void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, StringRef File,<br>
@@ -1386,8 +1390,8 @@ void DwarfUnit::constructMemberDIE(DIE &<br>
// Objective-C properties.<br>
if (DINode *PNode = DT->getObjCProperty())<br>
if (DIE *PDie = getDIE(PNode))<br>
- MemberDie.addValue(dwarf::DW_AT_APPLE_property, dwarf::DW_FORM_ref4,<br>
- DIEEntry(*PDie));<br>
+ MemberDie.addValue(DIEValueAllocator, dwarf::DW_AT_APPLE_property,<br>
+ dwarf::DW_FORM_ref4, DIEEntry(*PDie));<br>
<br>
if (DT->isArtificial())<br>
addFlag(MemberDie, dwarf::DW_AT_artificial);<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DwarfUnit.h-3Frev-3D240733-26r1-3D240732-26r2-3D240733-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hfyEVDYYRbyqBsqZCELui7T6Biv933KCYyOMbo_a3nI&s=BOKkk0Ryyudi6piOuG-VT_2Kf6wRX_BUSfn5kUKlRvE&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=240733&r1=240732&r2=240733&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Thu Jun 25 18:46:41 2015<br>
@@ -73,6 +73,9 @@ protected:<br>
/// MDNode for the compile unit.<br>
const DICompileUnit *CUNode;<br>
<br>
+ // All DIEValues are allocated through this allocator.<br>
+ BumpPtrAllocator DIEValueAllocator;<br>
+<br>
/// Unit debug information entry.<br>
DIE UnitDie;<br>
<br>
@@ -104,9 +107,6 @@ protected:<br>
/// corresponds to the MDNode mapped with the subprogram DIE.<br>
DenseMap<DIE *, const DINode *> ContainingTypeMap;<br>
<br>
- // All DIEValues are allocated through this allocator.<br>
- BumpPtrAllocator DIEValueAllocator;<br>
-<br>
/// The section this unit will be emitted in.<br>
MCSection *Section;<br>
<br>
@@ -206,8 +206,8 @@ public:<br>
void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str);<br>
<br>
/// \brief Add a Dwarf label attribute data and value.<br>
- void addLabel(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form,<br>
- const MCSymbol *Label);<br>
+ DIE::value_iterator addLabel(DIE &Die, dwarf::Attribute Attribute,<br>
+ dwarf::Form Form, const MCSymbol *Label);<br>
<br>
void addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label);<br>
<br>
<br>
Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_tools_dsymutil_DwarfLinker.cpp-3Frev-3D240733-26r1-3D240732-26r2-3D240733-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hfyEVDYYRbyqBsqZCELui7T6Biv933KCYyOMbo_a3nI&s=XMmOvxWRMTcFMGuizbzsew8lRYZbUG2IFCYnax78ir8&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=240733&r1=240732&r2=240733&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)<br>
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Thu Jun 25 18:46:41 2015<br>
@@ -60,33 +60,23 @@ using HalfOpenIntervalMap =<br>
<br>
typedef HalfOpenIntervalMap<uint64_t, int64_t> FunctionIntervals;<br>
<br>
-// FIXME: Delete this structure once DIE::Values has a stable iterator we can<br>
-// use instead.<br>
+// FIXME: Delete this structure.<br>
struct PatchLocation {<br>
- DIE *Die;<br>
- unsigned Index;<br>
+ DIE::value_iterator I;<br>
<br>
- PatchLocation() : Die(nullptr), Index(0) {}<br>
- PatchLocation(DIE &Die, unsigned Index) : Die(&Die), Index(Index) {}<br>
- PatchLocation(DIE &Die)<br>
- : Die(&Die), Index(std::distance(Die.values_begin(), Die.values_end())) {}<br>
+ PatchLocation() = default;<br>
+ PatchLocation(DIE::value_iterator I) : I(I) {}<br>
<br>
void set(uint64_t New) const {<br>
- assert(Die);<br>
- assert((signed)Index <<br>
- std::distance(Die->values_begin(), Die->values_end()));<br>
- const auto &Old = Die->values_begin()[Index];<br>
+ assert(I);<br>
+ const auto &Old = *I;<br>
assert(Old.getType() == DIEValue::isInteger);<br>
- Die->setValue(Index,<br>
- DIEValue(Old.getAttribute(), Old.getForm(), DIEInteger(New)));<br>
+ *I = DIEValue(Old.getAttribute(), Old.getForm(), DIEInteger(New));<br>
}<br>
<br>
uint64_t get() const {<br>
- assert(Die);<br>
- assert((signed)Index <<br>
- std::distance(Die->values_begin(), Die->values_end()));<br>
- assert(Die->values_begin()[Index].getType() == DIEValue::isInteger);<br>
- return Die->values_begin()[Index].getDIEInteger().getValue();<br>
+ assert(I);<br>
+ return I->getDIEInteger().getValue();<br>
}<br>
};<br>
<br>
@@ -1837,7 +1827,7 @@ unsigned DwarfLinker::cloneStringAttribu<br>
// Switch everything to out of line strings.<br>
const char *String = *Val.getAsCString(&U);<br>
unsigned Offset = StringPool.getStringOffset(String);<br>
- Die.addValue(dwarf::Attribute(AttrSpec.Attr), dwarf::DW_FORM_strp,<br>
+ Die.addValue(DIEAlloc, dwarf::Attribute(AttrSpec.Attr), dwarf::DW_FORM_strp,<br>
DIEInteger(Offset));<br>
return 4;<br>
}<br>
@@ -1887,18 +1877,21 @@ unsigned DwarfLinker::cloneDieReferenceA<br>
uint32_t NewRefOffset =<br>
RefUnit->getStartOffset() + NewRefDie->getOffset();<br>
Attr = NewRefOffset;<br>
+ Die.addValue(DIEAlloc, dwarf::Attribute(AttrSpec.Attr),<br>
+ dwarf::DW_FORM_ref_addr, DIEInteger(Attr));<br>
} else {<br>
// A forward reference. Note and fixup later.<br>
Attr = 0xBADDEF;<br>
- Unit.noteForwardReference(NewRefDie, RefUnit, PatchLocation(Die));<br>
+ Unit.noteForwardReference(<br>
+ NewRefDie, RefUnit,<br>
+ Die.addValue(DIEAlloc, dwarf::Attribute(AttrSpec.Attr),<br>
+ dwarf::DW_FORM_ref_addr, DIEInteger(Attr)));<br>
}<br>
- Die.addValue(dwarf::Attribute(AttrSpec.Attr), dwarf::DW_FORM_ref_addr,<br>
- DIEInteger(Attr));<br>
return AttrSize;<br>
}<br>
<br>
- Die.addValue(dwarf::Attribute(AttrSpec.Attr), dwarf::Form(AttrSpec.Form),<br>
- DIEEntry(*NewRefDie));<br>
+ Die.addValue(DIEAlloc, dwarf::Attribute(AttrSpec.Attr),<br>
+ dwarf::Form(AttrSpec.Form), DIEEntry(*NewRefDie));<br>
return AttrSize;<br>
}<br>
<br>
@@ -1930,8 +1923,8 @@ unsigned DwarfLinker::cloneBlockAttribut<br>
dwarf::Form(AttrSpec.Form), Block);<br>
ArrayRef<uint8_t> Bytes = *Val.getAsBlock();<br>
for (auto Byte : Bytes)<br>
- Attr->addValue(static_cast<dwarf::Attribute>(0), dwarf::DW_FORM_data1,<br>
- DIEInteger(Byte));<br>
+ Attr->addValue(DIEAlloc, static_cast<dwarf::Attribute>(0),<br>
+ dwarf::DW_FORM_data1, DIEInteger(Byte));<br>
// FIXME: If DIEBlock and DIELoc just reuses the Size field of<br>
// the DIE class, this if could be replaced by<br>
// Attr->setSize(Bytes.size()).<br>
@@ -1941,7 +1934,7 @@ unsigned DwarfLinker::cloneBlockAttribut<br>
else<br>
Block->ComputeSize(&Streamer->getAsmPrinter());<br>
}<br>
- Die.addValue(Value);<br>
+ Die.addValue(DIEAlloc, Value);<br>
return AttrSize;<br>
}<br>
<br>
@@ -1975,7 +1968,7 @@ unsigned DwarfLinker::cloneAddressAttrib<br>
Addr = (Info.OrigHighPc ? Info.OrigHighPc : Addr) + Info.PCOffset;<br>
}<br>
<br>
- Die.addValue(static_cast<dwarf::Attribute>(AttrSpec.Attr),<br>
+ Die.addValue(DIEAlloc, static_cast<dwarf::Attribute>(AttrSpec.Attr),<br>
static_cast<dwarf::Form>(AttrSpec.Form), DIEInteger(Addr));<br>
return Unit.getOrigUnit().getAddressByteSize();<br>
}<br>
@@ -2004,20 +1997,20 @@ unsigned DwarfLinker::cloneScalarAttribu<br>
&Unit.getOrigUnit(), &InputDIE);<br>
return 0;<br>
}<br>
- DIEInteger Attr(Value);<br>
+ PatchLocation Patch =<br>
+ Die.addValue(DIEAlloc, dwarf::Attribute(AttrSpec.Attr),<br>
+ dwarf::Form(AttrSpec.Form), DIEInteger(Value));<br>
if (AttrSpec.Attr == dwarf::DW_AT_ranges)<br>
- Unit.noteRangeAttribute(Die, PatchLocation(Die));<br>
+ Unit.noteRangeAttribute(Die, Patch);<br>
// A more generic way to check for location attributes would be<br>
// nice, but it's very unlikely that any other attribute needs a<br>
// location list.<br>
else if (AttrSpec.Attr == dwarf::DW_AT_location ||<br>
AttrSpec.Attr == dwarf::DW_AT_frame_base)<br>
- Unit.noteLocationAttribute(PatchLocation(Die), Info.PCOffset);<br>
+ Unit.noteLocationAttribute(Patch, Info.PCOffset);<br>
else if (AttrSpec.Attr == dwarf::DW_AT_declaration && Value)<br>
Info.IsDeclaration = true;<br>
<br>
- Die.addValue(dwarf::Attribute(AttrSpec.Attr), dwarf::Form(AttrSpec.Form),<br>
- Attr);<br>
return AttrSize;<br>
}<br>
<br>
@@ -2367,8 +2360,7 @@ static void insertLineSequence(std::vect<br>
static void patchStmtList(DIE &Die, DIEInteger Offset) {<br>
for (auto &V : Die.values())<br>
if (V.getAttribute() == dwarf::DW_AT_stmt_list) {<br>
- Die.setValue(&V - Die.values_begin(),<br>
- DIEValue(V.getAttribute(), V.getForm(), Offset));<br>
+ V = DIEValue(V.getAttribute(), V.getForm(), Offset);<br>
return;<br>
}<br>
<br>
<br>
Modified: llvm/trunk/unittests/CodeGen/DIEHashTest.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_unittests_CodeGen_DIEHashTest.cpp-3Frev-3D240733-26r1-3D240732-26r2-3D240733-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hfyEVDYYRbyqBsqZCELui7T6Biv933KCYyOMbo_a3nI&s=9wcDtHoCECg0sDjOLjazbFd3SXRp90RKRbl6CiWvZ8Q&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CodeGen/DIEHashTest.cpp?rev=240733&r1=240732&r2=240733&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/unittests/CodeGen/DIEHashTest.cpp (original)<br>
+++ llvm/trunk/unittests/CodeGen/DIEHashTest.cpp Thu Jun 25 18:46:41 2015<br>
@@ -22,6 +22,10 @@ namespace {<br>
<br>
// Test fixture<br>
class DIEHashTest : public testing::Test {<br>
+public:<br>
+ BumpPtrAllocator Alloc;<br>
+<br>
+private:<br>
StringMap<DwarfStringPoolEntry> Pool;<br>
<br>
public:<br>
@@ -36,7 +40,7 @@ TEST_F(DIEHashTest, Data1) {<br>
DIEHash Hash;<br>
DIE Die(dwarf::DW_TAG_base_type);<br>
DIEInteger Size(4);<br>
- Die.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Size);<br>
+ Die.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Size);<br>
uint64_t MD5Res = Hash.computeTypeSignature(Die);<br>
ASSERT_EQ(0x1AFE116E83701108ULL, MD5Res);<br>
}<br>
@@ -45,11 +49,11 @@ TEST_F(DIEHashTest, Data1) {<br>
TEST_F(DIEHashTest, TrivialType) {<br>
DIE Unnamed(dwarf::DW_TAG_structure_type);<br>
DIEInteger One(1);<br>
- Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ Unnamed.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
<br>
// Line and file number are ignored.<br>
- Unnamed.addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
- Unnamed.addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, One);<br>
+ Unnamed.addValue(Alloc, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
+ Unnamed.addValue(Alloc, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, One);<br>
uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);<br>
<br>
// The exact same hash GCC produces for this DIE.<br>
@@ -61,8 +65,8 @@ TEST_F(DIEHashTest, NamedType) {<br>
DIE Foo(dwarf::DW_TAG_structure_type);<br>
DIEInteger One(1);<br>
DIEString FooStr = getString("foo");<br>
- Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
- Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
<br>
uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);<br>
<br>
@@ -77,15 +81,16 @@ TEST_F(DIEHashTest, NamespacedType) {<br>
auto Space = make_unique<DIE>(dwarf::DW_TAG_namespace);<br>
DIEInteger One(1);<br>
DIEString SpaceStr = getString("space");<br>
- Space->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, SpaceStr);<br>
+ Space->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, SpaceStr);<br>
// DW_AT_declaration is ignored.<br>
- Space->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, One);<br>
+ Space->addValue(Alloc, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present,<br>
+ One);<br>
// sibling?<br>
<br>
auto Foo = make_unique<DIE>(dwarf::DW_TAG_structure_type);<br>
DIEString FooStr = getString("foo");<br>
- Foo->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
- Foo->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ Foo->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo->addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
<br>
DIE &N = *Foo;<br>
Space->addChild(std::move(Foo));<br>
@@ -101,24 +106,24 @@ TEST_F(DIEHashTest, NamespacedType) {<br>
TEST_F(DIEHashTest, TypeWithMember) {<br>
DIE Unnamed(dwarf::DW_TAG_structure_type);<br>
DIEInteger Four(4);<br>
- Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);<br>
+ Unnamed.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);<br>
<br>
DIE Int(dwarf::DW_TAG_base_type);<br>
DIEString IntStr = getString("int");<br>
- Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, IntStr);<br>
- Int.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);<br>
+ Int.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, IntStr);<br>
+ Int.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);<br>
DIEInteger Five(5);<br>
- Int.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Five);<br>
+ Int.addValue(Alloc, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Five);<br>
<br>
DIEEntry IntRef(Int);<br>
<br>
auto Member = make_unique<DIE>(dwarf::DW_TAG_member);<br>
DIEString MemberStr = getString("member");<br>
- Member->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemberStr);<br>
+ Member->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemberStr);<br>
DIEInteger Zero(0);<br>
- Member->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
- Zero);<br>
- Member->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IntRef);<br>
+ Member->addValue(Alloc, dwarf::DW_AT_data_member_location,<br>
+ dwarf::DW_FORM_data1, Zero);<br>
+ Member->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IntRef);<br>
<br>
Unnamed.addChild(std::move(Member));<br>
<br>
@@ -131,34 +136,34 @@ TEST_F(DIEHashTest, TypeWithMember) {<br>
TEST_F(DIEHashTest, ReusedType) {<br>
DIE Unnamed(dwarf::DW_TAG_structure_type);<br>
DIEInteger Eight(8);<br>
- Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ Unnamed.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
<br>
DIEInteger Four(4);<br>
DIE Int(dwarf::DW_TAG_base_type);<br>
DIEString IntStr = getString("int");<br>
- Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, IntStr);<br>
- Int.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);<br>
+ Int.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, IntStr);<br>
+ Int.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);<br>
DIEInteger Five(5);<br>
- Int.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Five);<br>
+ Int.addValue(Alloc, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Five);<br>
<br>
DIEEntry IntRef(Int);<br>
<br>
auto Mem1 = make_unique<DIE>(dwarf::DW_TAG_member);<br>
DIEString Mem1Str = getString("mem1");<br>
- Mem1->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, Mem1Str);<br>
+ Mem1->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, Mem1Str);<br>
DIEInteger Zero(0);<br>
- Mem1->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
+ Mem1->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
Zero);<br>
- Mem1->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IntRef);<br>
+ Mem1->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IntRef);<br>
<br>
Unnamed.addChild(std::move(Mem1));<br>
<br>
auto Mem2 = make_unique<DIE>(dwarf::DW_TAG_member);<br>
DIEString Mem2Str = getString("mem2");<br>
- Mem2->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, Mem2Str);<br>
- Mem2->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
+ Mem2->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, Mem2Str);<br>
+ Mem2->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
Four);<br>
- Mem2->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IntRef);<br>
+ Mem2->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IntRef);<br>
<br>
Unnamed.addChild(std::move(Mem2));<br>
<br>
@@ -171,15 +176,15 @@ TEST_F(DIEHashTest, ReusedType) {<br>
TEST_F(DIEHashTest, RecursiveType) {<br>
DIE Foo(dwarf::DW_TAG_structure_type);<br>
DIEInteger One(1);<br>
- Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
DIEString FooStr = getString("foo");<br>
- Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
<br>
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);<br>
DIEString MemStr = getString("mem");<br>
- Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
DIEEntry FooRef(Foo);<br>
- Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooRef);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooRef);<br>
// DW_AT_external and DW_AT_declaration are ignored anyway, so skip them.<br>
<br>
Foo.addChild(std::move(Mem));<br>
@@ -193,23 +198,24 @@ TEST_F(DIEHashTest, RecursiveType) {<br>
TEST_F(DIEHashTest, Pointer) {<br>
DIE Foo(dwarf::DW_TAG_structure_type);<br>
DIEInteger Eight(8);<br>
- Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
DIEString FooStr = getString("foo");<br>
- Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
<br>
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);<br>
DIEString MemStr = getString("mem");<br>
- Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
DIEInteger Zero(0);<br>
- Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1, Zero);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
+ Zero);<br>
<br>
DIE FooPtr(dwarf::DW_TAG_pointer_type);<br>
- FooPtr.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ FooPtr.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
DIEEntry FooRef(Foo);<br>
- FooPtr.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooRef);<br>
+ FooPtr.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooRef);<br>
<br>
DIEEntry FooPtrRef(FooPtr);<br>
- Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooPtrRef);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooPtrRef);<br>
<br>
Foo.addChild(std::move(Mem));<br>
<br>
@@ -222,27 +228,29 @@ TEST_F(DIEHashTest, Pointer) {<br>
TEST_F(DIEHashTest, Reference) {<br>
DIE Foo(dwarf::DW_TAG_structure_type);<br>
DIEInteger Eight(8);<br>
- Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
DIEString FooStr = getString("foo");<br>
- Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
<br>
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);<br>
DIEString MemStr = getString("mem");<br>
- Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
DIEInteger Zero(0);<br>
- Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1, Zero);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
+ Zero);<br>
<br>
DIE FooRef(dwarf::DW_TAG_reference_type);<br>
- FooRef.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ FooRef.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
DIEEntry FooEntry(Foo);<br>
- FooRef.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooEntry);<br>
+ FooRef.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooEntry);<br>
<br>
DIE FooRefConst(dwarf::DW_TAG_const_type);<br>
DIEEntry FooRefRef(FooRef);<br>
- FooRefConst.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooRefRef);<br>
+ FooRefConst.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,<br>
+ FooRefRef);<br>
<br>
DIEEntry FooRefConstRef(FooRefConst);<br>
- Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooRefConstRef);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooRefConstRef);<br>
<br>
Foo.addChild(std::move(Mem));<br>
<br>
@@ -255,27 +263,29 @@ TEST_F(DIEHashTest, Reference) {<br>
TEST_F(DIEHashTest, RValueReference) {<br>
DIE Foo(dwarf::DW_TAG_structure_type);<br>
DIEInteger Eight(8);<br>
- Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
DIEString FooStr = getString("foo");<br>
- Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
<br>
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);<br>
DIEString MemStr = getString("mem");<br>
- Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
DIEInteger Zero(0);<br>
- Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1, Zero);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
+ Zero);<br>
<br>
DIE FooRef(dwarf::DW_TAG_rvalue_reference_type);<br>
- FooRef.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ FooRef.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
DIEEntry FooEntry(Foo);<br>
- FooRef.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooEntry);<br>
+ FooRef.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooEntry);<br>
<br>
DIE FooRefConst(dwarf::DW_TAG_const_type);<br>
DIEEntry FooRefRef(FooRef);<br>
- FooRefConst.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooRefRef);<br>
+ FooRefConst.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,<br>
+ FooRefRef);<br>
<br>
DIEEntry FooRefConstRef(FooRefConst);<br>
- Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooRefConstRef);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooRefConstRef);<br>
<br>
Foo.addChild(std::move(Mem));<br>
<br>
@@ -288,24 +298,25 @@ TEST_F(DIEHashTest, RValueReference) {<br>
TEST_F(DIEHashTest, PtrToMember) {<br>
DIE Foo(dwarf::DW_TAG_structure_type);<br>
DIEInteger Eight(8);<br>
- Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
DIEString FooStr = getString("foo");<br>
- Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
<br>
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);<br>
DIEString MemStr = getString("mem");<br>
- Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
DIEInteger Zero(0);<br>
- Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1, Zero);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
+ Zero);<br>
<br>
DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);<br>
DIEEntry FooEntry(Foo);<br>
- PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooEntry);<br>
- PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,<br>
+ PtrToFooMem.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooEntry);<br>
+ PtrToFooMem.addValue(Alloc, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,<br>
FooEntry);<br>
<br>
DIEEntry PtrToFooMemRef(PtrToFooMem);<br>
- Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, PtrToFooMemRef);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, PtrToFooMemRef);<br>
<br>
Foo.addChild(std::move(Mem));<br>
<br>
@@ -329,27 +340,30 @@ TEST_F(DIEHashTest, PtrToMemberDeclDefMa<br>
uint64_t MD5ResDecl;<br>
{<br>
DIE Bar(dwarf::DW_TAG_structure_type);<br>
- Bar.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, BarStr);<br>
- Bar.addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, One);<br>
+ Bar.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, BarStr);<br>
+ Bar.addValue(Alloc, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present,<br>
+ One);<br>
<br>
DIE Foo(dwarf::DW_TAG_structure_type);<br>
- Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
- Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
<br>
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);<br>
- Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
- Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
- Zero);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_data_member_location,<br>
+ dwarf::DW_FORM_data1, Zero);<br>
<br>
DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);<br>
DIEEntry BarEntry(Bar);<br>
- PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, BarEntry);<br>
+ PtrToFooMem.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,<br>
+ BarEntry);<br>
DIEEntry FooEntry(Foo);<br>
- PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,<br>
- FooEntry);<br>
+ PtrToFooMem.addValue(Alloc, dwarf::DW_AT_containing_type,<br>
+ dwarf::DW_FORM_ref4, FooEntry);<br>
<br>
DIEEntry PtrToFooMemRef(PtrToFooMem);<br>
- Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, PtrToFooMemRef);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,<br>
+ PtrToFooMemRef);<br>
<br>
Foo.addChild(std::move(Mem));<br>
<br>
@@ -358,27 +372,29 @@ TEST_F(DIEHashTest, PtrToMemberDeclDefMa<br>
uint64_t MD5ResDef;<br>
{<br>
DIE Bar(dwarf::DW_TAG_structure_type);<br>
- Bar.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, BarStr);<br>
- Bar.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ Bar.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, BarStr);<br>
+ Bar.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
<br>
DIE Foo(dwarf::DW_TAG_structure_type);<br>
- Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
- Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
<br>
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);<br>
- Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
- Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
- Zero);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_data_member_location,<br>
+ dwarf::DW_FORM_data1, Zero);<br>
<br>
DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);<br>
DIEEntry BarEntry(Bar);<br>
- PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, BarEntry);<br>
+ PtrToFooMem.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,<br>
+ BarEntry);<br>
DIEEntry FooEntry(Foo);<br>
- PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,<br>
- FooEntry);<br>
+ PtrToFooMem.addValue(Alloc, dwarf::DW_AT_containing_type,<br>
+ dwarf::DW_FORM_ref4, FooEntry);<br>
<br>
DIEEntry PtrToFooMemRef(PtrToFooMem);<br>
- Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, PtrToFooMemRef);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,<br>
+ PtrToFooMemRef);<br>
<br>
Foo.addChild(std::move(Mem));<br>
<br>
@@ -402,26 +418,29 @@ TEST_F(DIEHashTest, PtrToMemberDeclDefMi<br>
uint64_t MD5ResDecl;<br>
{<br>
DIE Bar(dwarf::DW_TAG_structure_type);<br>
- Bar.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, BarStr);<br>
- Bar.addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, One);<br>
+ Bar.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, BarStr);<br>
+ Bar.addValue(Alloc, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present,<br>
+ One);<br>
<br>
DIE Foo(dwarf::DW_TAG_structure_type);<br>
- Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
- Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
<br>
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);<br>
- Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
- Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
- Zero);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_data_member_location,<br>
+ dwarf::DW_FORM_data1, Zero);<br>
<br>
DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);<br>
DIEEntry BarEntry(Bar);<br>
- PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, BarEntry);<br>
- PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,<br>
+ PtrToFooMem.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,<br>
BarEntry);<br>
+ PtrToFooMem.addValue(Alloc, dwarf::DW_AT_containing_type,<br>
+ dwarf::DW_FORM_ref4, BarEntry);<br>
<br>
DIEEntry PtrToFooMemRef(PtrToFooMem);<br>
- Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, PtrToFooMemRef);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,<br>
+ PtrToFooMemRef);<br>
<br>
Foo.addChild(std::move(Mem));<br>
<br>
@@ -430,26 +449,28 @@ TEST_F(DIEHashTest, PtrToMemberDeclDefMi<br>
uint64_t MD5ResDef;<br>
{<br>
DIE Bar(dwarf::DW_TAG_structure_type);<br>
- Bar.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, BarStr);<br>
- Bar.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ Bar.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, BarStr);<br>
+ Bar.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
<br>
DIE Foo(dwarf::DW_TAG_structure_type);<br>
- Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
- Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
<br>
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);<br>
- Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
- Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
- Zero);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_data_member_location,<br>
+ dwarf::DW_FORM_data1, Zero);<br>
<br>
DIE PtrToFooMem(dwarf::DW_TAG_ptr_to_member_type);<br>
DIEEntry BarEntry(Bar);<br>
- PtrToFooMem.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, BarEntry);<br>
- PtrToFooMem.addValue(dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,<br>
+ PtrToFooMem.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,<br>
BarEntry);<br>
+ PtrToFooMem.addValue(Alloc, dwarf::DW_AT_containing_type,<br>
+ dwarf::DW_FORM_ref4, BarEntry);<br>
<br>
DIEEntry PtrToFooMemRef(PtrToFooMem);<br>
- Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, PtrToFooMemRef);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,<br>
+ PtrToFooMemRef);<br>
<br>
Foo.addChild(std::move(Mem));<br>
<br>
@@ -473,23 +494,26 @@ TEST_F(DIEHashTest, RefUnnamedType) {<br>
DIEString MemStr = getString("mem");<br>
<br>
DIE Unnamed(dwarf::DW_TAG_structure_type);<br>
- Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ Unnamed.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
<br>
DIE Foo(dwarf::DW_TAG_structure_type);<br>
- Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
- Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ Foo.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
<br>
auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);<br>
- Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
- Mem->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1, Zero);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br>
+ Zero);<br>
<br>
DIE UnnamedPtr(dwarf::DW_TAG_pointer_type);<br>
- UnnamedPtr.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br>
+ UnnamedPtr.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1,<br>
+ Eight);<br>
DIEEntry UnnamedRef(Unnamed);<br>
- UnnamedPtr.addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, UnnamedRef);<br>
+ UnnamedPtr.addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4,<br>
+ UnnamedRef);<br>
<br>
DIEEntry UnnamedPtrRef(UnnamedPtr);<br>
- Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, UnnamedPtrRef);<br>
+ Mem->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, UnnamedPtrRef);<br>
<br>
Foo.addChild(std::move(Mem));<br>
<br>
@@ -502,12 +526,12 @@ TEST_F(DIEHashTest, RefUnnamedType) {<br>
TEST_F(DIEHashTest, NestedType) {<br>
DIE Unnamed(dwarf::DW_TAG_structure_type);<br>
DIEInteger One(1);<br>
- Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ Unnamed.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
<br>
auto Foo = make_unique<DIE>(dwarf::DW_TAG_structure_type);<br>
DIEString FooStr = getString("foo");<br>
- Foo->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
- Foo->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ Foo->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br>
+ Foo->addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
<br>
Unnamed.addChild(std::move(Foo));<br>
<br>
@@ -521,11 +545,11 @@ TEST_F(DIEHashTest, NestedType) {<br>
TEST_F(DIEHashTest, MemberFunc) {<br>
DIE Unnamed(dwarf::DW_TAG_structure_type);<br>
DIEInteger One(1);<br>
- Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ Unnamed.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
<br>
auto Func = make_unique<DIE>(dwarf::DW_TAG_subprogram);<br>
DIEString FuncStr = getString("func");<br>
- Func->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FuncStr);<br>
+ Func->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FuncStr);<br>
<br>
Unnamed.addChild(std::move(Func));<br>
<br>
@@ -542,21 +566,24 @@ TEST_F(DIEHashTest, MemberFuncFlag) {<br>
DIE A(dwarf::DW_TAG_structure_type);<br>
DIEInteger One(1);<br>
DIEString AStr = getString("A");<br>
- A.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, AStr);<br>
- A.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
- A.addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
- A.addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, One);<br>
+ A.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, AStr);<br>
+ A.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ A.addValue(Alloc, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
+ A.addValue(Alloc, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, One);<br>
<br>
auto Func = make_unique<DIE>(dwarf::DW_TAG_subprogram);<br>
DIEString FuncStr = getString("func");<br>
DIEString FuncLinkage = getString("_ZN1A4funcEv");<br>
DIEInteger Two(2);<br>
- Func->addValue(dwarf::DW_AT_external, dwarf::DW_FORM_flag_present, One);<br>
- Func->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FuncStr);<br>
- Func->addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
- Func->addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, Two);<br>
- Func->addValue(dwarf::DW_AT_linkage_name, dwarf::DW_FORM_strp, FuncLinkage);<br>
- Func->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, One);<br>
+ Func->addValue(Alloc, dwarf::DW_AT_external, dwarf::DW_FORM_flag_present,<br>
+ One);<br>
+ Func->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FuncStr);<br>
+ Func->addValue(Alloc, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
+ Func->addValue(Alloc, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, Two);<br>
+ Func->addValue(Alloc, dwarf::DW_AT_linkage_name, dwarf::DW_FORM_strp,<br>
+ FuncLinkage);<br>
+ Func->addValue(Alloc, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present,<br>
+ One);<br>
<br>
A.addChild(std::move(Func));<br>
<br>
@@ -575,35 +602,36 @@ TEST_F(DIEHashTest, MemberSdata) {<br>
DIE A(dwarf::DW_TAG_structure_type);<br>
DIEInteger One(1);<br>
DIEString AStr = getString("A");<br>
- A.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, AStr);<br>
- A.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
- A.addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
- A.addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, One);<br>
+ A.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, AStr);<br>
+ A.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ A.addValue(Alloc, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
+ A.addValue(Alloc, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, One);<br>
<br>
DIEInteger Four(4);<br>
DIEInteger Five(5);<br>
DIEString FStr = getString("int");<br>
DIE IntTyDIE(dwarf::DW_TAG_base_type);<br>
- IntTyDIE.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);<br>
- IntTyDIE.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Five);<br>
- IntTyDIE.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FStr);<br>
+ IntTyDIE.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);<br>
+ IntTyDIE.addValue(Alloc, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Five);<br>
+ IntTyDIE.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FStr);<br>
<br>
DIEEntry IntTy(IntTyDIE);<br>
auto PITyDIE = make_unique<DIE>(dwarf::DW_TAG_const_type);<br>
- PITyDIE->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IntTy);<br>
+ PITyDIE->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IntTy);<br>
<br>
DIEEntry PITy(*PITyDIE);<br>
auto PI = make_unique<DIE>(dwarf::DW_TAG_member);<br>
DIEString PIStr = getString("PI");<br>
DIEInteger Two(2);<br>
DIEInteger NegThree(-3);<br>
- PI->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, PIStr);<br>
- PI->addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
- PI->addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, Two);<br>
- PI->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, PITy);<br>
- PI->addValue(dwarf::DW_AT_external, dwarf::DW_FORM_flag_present, One);<br>
- PI->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, One);<br>
- PI->addValue(dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata, NegThree);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, PIStr);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, Two);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, PITy);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_external, dwarf::DW_FORM_flag_present, One);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present,<br>
+ One);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata, NegThree);<br>
<br>
A.addChild(std::move(PI));<br>
<br>
@@ -620,32 +648,35 @@ TEST_F(DIEHashTest, MemberBlock) {<br>
DIE A(dwarf::DW_TAG_structure_type);<br>
DIEInteger One(1);<br>
DIEString AStr = getString("A");<br>
- A.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, AStr);<br>
- A.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
- A.addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
- A.addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, One);<br>
+ A.addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, AStr);<br>
+ A.addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br>
+ A.addValue(Alloc, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
+ A.addValue(Alloc, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, One);<br>
<br>
DIEInteger Four(4);<br>
DIEString FStr = getString("float");<br>
auto FloatTyDIE = make_unique<DIE>(dwarf::DW_TAG_base_type);<br>
- FloatTyDIE->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);<br>
- FloatTyDIE->addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Four);<br>
- FloatTyDIE->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FStr);<br>
+ FloatTyDIE->addValue(Alloc, dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1,<br>
+ Four);<br>
+ FloatTyDIE->addValue(Alloc, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,<br>
+ Four);<br>
+ FloatTyDIE->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, FStr);<br>
<br>
DIEEntry FloatTy(*FloatTyDIE);<br>
auto PITyDIE = make_unique<DIE>(dwarf::DW_TAG_const_type);<br>
- PITyDIE->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FloatTy);<br>
+ PITyDIE->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FloatTy);<br>
<br>
DIEEntry PITy(*PITyDIE);<br>
auto PI = make_unique<DIE>(dwarf::DW_TAG_member);<br>
DIEString PIStr = getString("PI");<br>
DIEInteger Two(2);<br>
- PI->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, PIStr);<br>
- PI->addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
- PI->addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, Two);<br>
- PI->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, PITy);<br>
- PI->addValue(dwarf::DW_AT_external, dwarf::DW_FORM_flag_present, One);<br>
- PI->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, One);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_name, dwarf::DW_FORM_strp, PIStr);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, Two);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, PITy);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_external, dwarf::DW_FORM_flag_present, One);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present,<br>
+ One);<br>
<br>
DIEBlock PIBlock;<br>
DIEInteger Blk1(0xc3);<br>
@@ -653,12 +684,13 @@ TEST_F(DIEHashTest, MemberBlock) {<br>
DIEInteger Blk3(0x48);<br>
DIEInteger Blk4(0x40);<br>
<br>
- PIBlock.addValue((dwarf::Attribute)0, dwarf::DW_FORM_data1, Blk1);<br>
- PIBlock.addValue((dwarf::Attribute)0, dwarf::DW_FORM_data1, Blk2);<br>
- PIBlock.addValue((dwarf::Attribute)0, dwarf::DW_FORM_data1, Blk3);<br>
- PIBlock.addValue((dwarf::Attribute)0, dwarf::DW_FORM_data1, Blk4);<br>
+ PIBlock.addValue(Alloc, (dwarf::Attribute)0, dwarf::DW_FORM_data1, Blk1);<br>
+ PIBlock.addValue(Alloc, (dwarf::Attribute)0, dwarf::DW_FORM_data1, Blk2);<br>
+ PIBlock.addValue(Alloc, (dwarf::Attribute)0, dwarf::DW_FORM_data1, Blk3);<br>
+ PIBlock.addValue(Alloc, (dwarf::Attribute)0, dwarf::DW_FORM_data1, Blk4);<br>
<br>
- PI->addValue(dwarf::DW_AT_const_value, dwarf::DW_FORM_block1, &PIBlock);<br>
+ PI->addValue(Alloc, dwarf::DW_AT_const_value, dwarf::DW_FORM_block1,<br>
+ &PIBlock);<br>
<br>
A.addChild(std::move(PI));<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>