<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 27, 2015 at 3:44 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dexonsmith<br>
Date: Wed May 27 17:44:06 2015<br>
New Revision: 238369<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D238369-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=0viUed_8hCtZBohbQcYpvVMcJGi4ykmQ6vqqSi_1uxI&s=zKmVfx0H7cbElJjUsIOsOSL4ADQ7KBUcqU9X2n86veU&e=" target="_blank">http://llvm.org/viewvc/llvm-project?rev=238369&view=rev</a><br>
Log:<br>
AsmPrinter: Stop exposing underlying DIEValue list, NFC<br>
<br>
Change the `DIE` API to hide the implementation of the list of<br>
`DIEValue`s.<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/CodeGen/DIE.h<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp<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/DwarfFile.cpp<br>
    llvm/trunk/tools/dsymutil/DwarfLinker.cpp<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-3D238369-26r1-3D238368-26r2-3D238369-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=0viUed_8hCtZBohbQcYpvVMcJGi4ykmQ6vqqSi_1uxI&s=BQ2a7Tc2NLoB-7UAi3jWxiiRMkUAhkxeQv6zyTIzkXs&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DIE.h?rev=238369&r1=238368&r2=238369&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/DIE.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/DIE.h Wed May 27 17:44:06 2015<br>
@@ -499,7 +499,16 @@ public:<br>
   const std::vector<std::unique_ptr<DIE>> &getChildren() const {<br>
     return Children;<br>
   }<br>
-  const SmallVectorImpl<DIEValue> &getValues() const { return Values; }<br>
+<br>
+  typedef SmallVectorImpl<DIEValue>::const_iterator value_iterator;<br>
+  typedef iterator_range<value_iterator> value_range;<br>
+<br>
+  value_iterator begin_values() const { return Values.begin(); }<br>
+  value_iterator end_values() const { return Values.end(); }<br></blockquote><div><br>Is this the prevailing naming convention for exposing a named range? I think we have a fair few "foo_begin/foo_end" & not sure I've seen much "end_foo/begin_foo", but I could be wrong.<br><br>(alternatively - (optionally add range-based APIs for anything you currently need begin/end for, and) skip begin/end in favor of using the range accessor below)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+  value_range values() const {<br>
+    return llvm::make_range(begin_values(), end_values());<br>
+  }<br>
+<br>
   void setValue(unsigned I, DIEValue New) {<br>
     assert(I < Values.size());<br>
     Values[I] = New;<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_AsmPrinterDwarf.cpp-3Frev-3D238369-26r1-3D238368-26r2-3D238369-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=0viUed_8hCtZBohbQcYpvVMcJGi4ykmQ6vqqSi_1uxI&s=jl0Gc0bzxru7KYTApIvg_G6zOjenr7p1swnrM_KwEMg&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=238369&r1=238368&r2=238369&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Wed May 27 17:44:06 2015<br>
@@ -262,23 +262,21 @@ void AsmPrinter::emitDwarfDIE(const DIE<br>
                             dwarf::TagString(Die.getTag()));<br>
   EmitULEB128(Die.getAbbrevNumber());<br>
<br>
-  const SmallVectorImpl<DIEValue> &Values = Die.getValues();<br>
-<br>
   // Emit the DIE attribute values.<br>
-  for (unsigned i = 0, N = Values.size(); i < N; ++i) {<br>
-    dwarf::Attribute Attr = Values[i].getAttribute();<br>
-    dwarf::Form Form = Values[i].getForm();<br>
+  for (const auto &V : Die.values()) {<br>
+    dwarf::Attribute Attr = V.getAttribute();<br>
+    dwarf::Form Form = V.getForm();<br>
     assert(Form && "Too many attributes for DIE (check abbreviation)");<br>
<br>
     if (isVerbose()) {<br>
       OutStreamer->AddComment(dwarf::AttributeString(Attr));<br>
       if (Attr == dwarf::DW_AT_accessibility)<br>
         OutStreamer->AddComment(<br>
-            dwarf::AccessibilityString(Values[i].getDIEInteger().getValue()));<br>
+            dwarf::AccessibilityString(V.getDIEInteger().getValue()));<br>
     }<br>
<br>
     // Emit an attribute using the defined form.<br>
-    Values[i].EmitValue(this, Form);<br>
+    V.EmitValue(this, Form);<br>
   }<br>
<br>
   // Emit the DIE children if any.<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-3D238369-26r1-3D238368-26r2-3D238369-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=0viUed_8hCtZBohbQcYpvVMcJGi4ykmQ6vqqSi_1uxI&s=d0rCUdwY8vSr1EPQyqu37q6_tCttbjytU4cxqOPxtp4&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=238369&r1=238368&r2=238369&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Wed May 27 17:44:06 2015<br>
@@ -136,13 +136,11 @@ const DIE *DIE::getUnitOrNull() const {<br>
 }<br>
<br>
 DIEValue DIE::findAttribute(dwarf::Attribute Attribute) const {<br>
-  const SmallVectorImpl<DIEValue> &Values = getValues();<br>
-<br>
   // Iterate through all the attributes until we find the one we're<br>
   // looking for, if we can't find it return NULL.<br>
-  for (size_t i = 0; i < Values.size(); ++i)<br>
-    if (Values[i].getAttribute() == Attribute)<br>
-      return Values[i];<br>
+  for (const auto &V : values())<br>
+    if (V.getAttribute() == Attribute)<br>
+      return V;<br>
   return DIEValue();<br>
 }<br>
<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-3D238369-26r1-3D238368-26r2-3D238369-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=0viUed_8hCtZBohbQcYpvVMcJGi4ykmQ6vqqSi_1uxI&s=kyaghUKbYaWunHa40koYMUa2UubtEvEMwICBatPKhDA&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp?rev=238369&r1=238368&r2=238369&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp Wed May 27 17:44:06 2015<br>
@@ -31,14 +31,12 @@ using namespace llvm;<br>
 /// \brief Grabs the string in whichever attribute is passed in and returns<br>
 /// a reference to it.<br>
 static StringRef getDIEStringAttr(const DIE &Die, uint16_t Attr) {<br>
-  const auto &Values = Die.getValues();<br>
-<br>
   // Iterate through all the attributes until we find the one we're<br>
   // looking for, if we can't find it return an empty string.<br>
-  for (size_t i = 0; i < Values.size(); ++i) {<br>
-    if (Values[i].getAttribute() == Attr)<br>
-      return Values[i].getDIEString().getString();<br>
-  }<br>
+  for (const auto &V : Die.values())<br>
+    if (V.getAttribute() == Attr)<br>
+      return V.getDIEString().getString();<br>
+<br>
   return StringRef("");<br>
 }<br>
<br>
@@ -118,18 +116,16 @@ void DIEHash::addParentContext(const DIE<br>
<br>
 // Collect all of the attributes for a particular DIE in single structure.<br>
 void DIEHash::collectAttributes(const DIE &Die, DIEAttrs &Attrs) {<br>
-  const SmallVectorImpl<DIEValue> &Values = Die.getValues();<br>
-<br>
 #define COLLECT_ATTR(NAME)                                                     \<br>
   case dwarf::NAME:                                                            \<br>
-    Attrs.NAME = Values[i];                                                    \<br>
+    Attrs.NAME = V;                                                            \<br>
     break<br>
<br>
-  for (size_t i = 0, e = Values.size(); i != e; ++i) {<br>
+  for (const auto &V : Die.values()) {<br>
     DEBUG(dbgs() << "Attribute: "<br>
-                 << dwarf::AttributeString(Values[i].getAttribute())<br>
+                 << dwarf::AttributeString(V.getAttribute())<br>
                  << " added.\n");<br>
-    switch (Values[i].getAttribute()) {<br>
+    switch (V.getAttribute()) {<br>
       COLLECT_ATTR(DW_AT_name);<br>
       COLLECT_ATTR(DW_AT_accessibility);<br>
       COLLECT_ATTR(DW_AT_address_class);<br>
@@ -267,9 +263,9 @@ 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 SmallVectorImpl<DIEValue> &Values) {<br>
-  for (auto I = Values.begin(), E = Values.end(); I != E; ++I)<br>
-    Hash.update((uint64_t)I->getDIEInteger().getValue());<br>
+void DIEHash::hashBlockData(const DIE::value_range &Values) {<br>
+  for (const auto &V : Values)<br>
+    Hash.update((uint64_t)V.getDIEInteger().getValue());<br>
 }<br>
<br>
 // Hash the contents of a loclistptr class.<br>
@@ -342,10 +338,10 @@ void DIEHash::hashAttribute(DIEValue Val<br>
     addULEB128(dwarf::DW_FORM_block);<br>
     if (Value.getType() == DIEValue::isBlock) {<br>
       addULEB128(Value.getDIEBlock().ComputeSize(AP));<br>
-      hashBlockData(Value.getDIEBlock().getValues());<br>
+      hashBlockData(Value.getDIEBlock().values());<br>
     } else if (Value.getType() == DIEValue::isLoc) {<br>
       addULEB128(Value.getDIELoc().ComputeSize(AP));<br>
-      hashBlockData(Value.getDIELoc().getValues());<br>
+      hashBlockData(Value.getDIELoc().values());<br>
     } else {<br>
       // We could add the block length, but that would take<br>
       // a bit of work and not add a lot of uniqueness<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-3D238369-26r1-3D238368-26r2-3D238369-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=0viUed_8hCtZBohbQcYpvVMcJGi4ykmQ6vqqSi_1uxI&s=xqBG40OyywUAZHj7UqMGuWjV7J4LWmM2MGSdfj7XgEQ&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h?rev=238369&r1=238368&r2=238369&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h Wed May 27 17:44:06 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 SmallVectorImpl<DIEValue> &Values);<br>
+  void hashBlockData(const DIE::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-3D238369-26r1-3D238368-26r2-3D238369-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=0viUed_8hCtZBohbQcYpvVMcJGi4ykmQ6vqqSi_1uxI&s=eCMikRhDWLCVF3V5zosKPFARlzZHDPEExr321HeEv9I&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=238369&r1=238368&r2=238369&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Wed May 27 17:44:06 2015<br>
@@ -242,7 +242,7 @@ void DwarfCompileUnit::initStmtList() {<br>
   MCSymbol *LineTableStartSym =<br>
       Asm->OutStreamer->getDwarfLineTableSymbol(getUniqueID());<br>
<br>
-  stmtListIndex = UnitDie.getValues().size();<br>
+  stmtListIndex = std::distance(UnitDie.begin_values(), UnitDie.end_values());<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>
@@ -255,7 +255,7 @@ void DwarfCompileUnit::initStmtList() {<br>
 }<br>
<br>
 void DwarfCompileUnit::applyStmtList(DIE &D) {<br>
-  D.addValue(UnitDie.getValues()[stmtListIndex]);<br>
+  D.addValue(UnitDie.begin_values()[stmtListIndex]);<br>
 }<br>
<br>
 void DwarfCompileUnit::attachLowHighPC(DIE &D, const MCSymbol *Begin,<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DwarfFile.cpp-3Frev-3D238369-26r1-3D238368-26r2-3D238369-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=0viUed_8hCtZBohbQcYpvVMcJGi4ykmQ6vqqSi_1uxI&s=CxkIzBbuKkr6E5Sr6KonPEcfIU_vHpNHdhvorv58ifY&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp?rev=238369&r1=238368&r2=238369&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp Wed May 27 17:44:06 2015<br>
@@ -97,13 +97,10 @@ unsigned DwarfFile::computeSizeAndOffset<br>
   // Start the size with the size of abbreviation code.<br>
   Offset += getULEB128Size(Die.getAbbrevNumber());<br>
<br>
-  const SmallVectorImpl<DIEValue> &Values = Die.getValues();<br>
-  const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();<br>
-<br>
   // Size the DIE attribute values.<br>
-  for (unsigned i = 0, N = Values.size(); i < N; ++i)<br>
+  for (const auto &V : Die.values())<br>
     // Size attribute value.<br>
-    Offset += Values[i].SizeOf(Asm, AbbrevData[i].getForm());<br>
+    Offset += V.SizeOf(Asm, V.getForm());<br>
<br>
   // Get the children.<br>
   const auto &Children = Die.getChildren();<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-3D238369-26r1-3D238368-26r2-3D238369-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=0viUed_8hCtZBohbQcYpvVMcJGi4ykmQ6vqqSi_1uxI&s=VHLYoJPEPxsSUR-rU7vyljk4KG41IQry6-JA2ksahqI&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=238369&r1=238368&r2=238369&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)<br>
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Wed May 27 17:44:06 2015<br>
@@ -68,11 +68,13 @@ struct PatchLocation {<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.begin_values(), Die.end_values())) {}<br>
<br>
   void set(uint64_t New) const {<br>
     assert(Die);<br>
-    assert(Index < Die->getValues().size());<br>
-    const auto &Old = Die->getValues()[Index];<br>
+    assert(Index < std::distance(Die->begin_values(), Die->end_values()));<br>
+    const auto &Old = Die->begin_values()[Index];<br>
     assert(Old.getType() == DIEValue::isInteger);<br>
     Die->setValue(Index,<br>
                   DIEValue(Old.getAttribute(), Old.getForm(), DIEInteger(New)));<br>
@@ -80,9 +82,9 @@ struct PatchLocation {<br>
<br>
   uint64_t get() const {<br>
     assert(Die);<br>
-    assert(Index < Die->getValues().size());<br>
-    assert(Die->getValues()[Index].getType() == DIEValue::isInteger);<br>
-    return Die->getValues()[Index].getDIEInteger().getValue();<br>
+    assert(Index < std::distance(Die->begin_values(), Die->end_values()));<br>
+    assert(Die->begin_values()[Index].getType() == DIEValue::isInteger);<br>
+    return Die->begin_values()[Index].getDIEInteger().getValue();<br>
   }<br>
 };<br>
<br>
@@ -1839,8 +1841,7 @@ unsigned DwarfLinker::cloneDieReferenceA<br>
     } else {<br>
       // A forward reference. Note and fixup later.<br>
       Attr = 0xBADDEF;<br>
-      Unit.noteForwardReference(NewRefDie, RefUnit,<br>
-                                PatchLocation(Die, Die.getValues().size()));<br>
+      Unit.noteForwardReference(NewRefDie, RefUnit, PatchLocation(Die));<br>
     }<br>
     Die.addValue(dwarf::Attribute(AttrSpec.Attr), dwarf::DW_FORM_ref_addr,<br>
                  DIEInteger(Attr));<br>
@@ -1956,14 +1957,13 @@ unsigned DwarfLinker::cloneScalarAttribu<br>
   }<br>
   DIEInteger Attr(Value);<br>
   if (AttrSpec.Attr == dwarf::DW_AT_ranges)<br>
-    Unit.noteRangeAttribute(Die, PatchLocation(Die, Die.getValues().size()));<br>
+    Unit.noteRangeAttribute(Die, PatchLocation(Die));<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, Die.getValues().size()),<br>
-                               Info.PCOffset);<br>
+    Unit.noteLocationAttribute(PatchLocation(Die), Info.PCOffset);<br>
   else if (AttrSpec.Attr == dwarf::DW_AT_declaration && Value)<br>
     Info.IsDeclaration = true;<br>
<br>
@@ -2329,13 +2329,13 @@ void DwarfLinker::patchLineTableForUnit(<br>
<br>
   // Update the cloned DW_AT_stmt_list with the correct debug_line offset.<br>
   if (auto *OutputDIE = Unit.getOutputUnitDIE()) {<br>
-    const auto &Values = OutputDIE->getValues();<br>
-    auto Stmt =<br>
-        std::find_if(Values.begin(), Values.end(), [](const DIEValue &Value) {<br>
-          return Value.getAttribute() == dwarf::DW_AT_stmt_list;<br>
-        });<br>
-    assert(Stmt < Values.end() && "Didn't find DW_AT_stmt_list in cloned DIE!");<br>
-    OutputDIE->setValue(Stmt - Values.begin(),<br>
+    auto Stmt = std::find_if(OutputDIE->begin_values(), OutputDIE->end_values(),<br>
+                             [](const DIEValue &Value) {<br>
+      return Value.getAttribute() == dwarf::DW_AT_stmt_list;<br>
+    });<br>
+    assert(Stmt != OutputDIE->end_values() &&<br>
+           "Didn't find DW_AT_stmt_list in cloned DIE!");<br>
+    OutputDIE->setValue(Stmt - OutputDIE->begin_values(),<br>
                         DIEValue(Stmt->getAttribute(), Stmt->getForm(),<br>
                                  DIEInteger(Streamer->getLineSectionSize())));<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" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>