<p dir="ltr">Could you add test coverage and attach the entire patch (covering all source and test changes together) as a single file for review?</p>
<div class="gmail_quote">On Aug 28, 2014 6:28 AM, "Frédéric Riss" <<a href="mailto:friss@apple.com">friss@apple.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I’d like to apply this little hunk to have the compile unit low/high_pc obey the dwarf version setting:<br>
<br>
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
@@ -950,10 +950,7 @@ void DwarfDebug::finalizeModuleInfo() {<br>
           0);<br>
     } else {<br>
      RangeSpan &Range = TheU->getRanges().back();<br>
-Â Â Â Â Â U.addLocalLabelAddress(U.getUnitDie(), dwarf::DW_AT_low_pc,<br>
-Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Range.getStart());<br>
-Â Â Â Â Â U.addLabelDelta(U.getUnitDie(), dwarf::DW_AT_high_pc, Range.getEnd(),<br>
-Â Â Â Â Â Â Â Â Â Â Â Â Â Range.getStart());<br>
+Â Â Â Â Â attachLowHighPC(U, U.getUnitDie(), Range.getStart(), Range.getEnd());<br>
     }<br>
    }<br>
   }<br>
<br>
<br>
And it needs this const correctness fix to compile correctly:<br>
<br>
<br>
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
@@ -2610,7 +2607,7 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,<br>
 }<br>
<br>
 void DwarfDebug::attachLowHighPC(DwarfCompileUnit &Unit, DIE &D,<br>
-Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â MCSymbol *Begin, MCSymbol *End) {<br>
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â const MCSymbol *Begin, const MCSymbol *End) {<br>
  assert(Begin && "Begin label should not be null!");<br>
  assert(End && "End label should not be null!");<br>
  assert(Begin->isDefined() && "Invalid starting label");<br>
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.<br>
h<br>
index c0e7e43..3528b2b 100644<br>
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
@@ -562,8 +562,8 @@ class DwarfDebug : public AsmPrinterHandler {<br>
<br>
  void attachRangesOrLowHighPC(DwarfCompileUnit &Unit, DIE &D,<br>
                const SmallVectorImpl<InsnRange> &Ranges);<br>
-Â void attachLowHighPC(DwarfCompileUnit &Unit, DIE &D, MCSymbol *Begin,<br>
-Â Â Â Â Â Â Â Â Â Â Â Â MCSymbol *End);<br>
+Â void attachLowHighPC(DwarfCompileUnit &Unit, DIE &D, const MCSymbol *Begin,<br>
+Â Â Â Â Â Â Â Â Â Â Â Â const MCSymbol *End);<br>
<br>
 public:<br>
  //===--------------------------------------------------------------------===//<br>
<br>
<br>
Are these 2 patches OK to go in?<br>
<br>
Fred</blockquote></div>