<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 22, 2014 at 6:28 PM, Frédéric Riss <span dir="ltr"><<a href="mailto:friss@apple.com" target="_blank">friss@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
> On 22 Oct 2014, at 17:16, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
> Author: dblaikie<br>
> Date: Wed Oct 22 19:16:03 2014<br>
> New Revision: 220452<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=220452&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=220452&view=rev</a><br>
> Log:<br>
> [DebugInfo] Add DwarfDebug& to DwarfFile.<br>
><br>
> Use the DwarfDebug in one function that previously took it as a<br>
> parameter, and lay the foundation for use this for other operations<br>
> coming soon.<br>
><br>
> Modified:<br>
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp<br>
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=220452&r1=220451&r2=220452&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=220452&r1=220451&r2=220452&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Oct 22 19:16:03 2014<br>
> @@ -170,9 +170,10 @@ static LLVM_CONSTEXPR DwarfAccelTable::A<br>
><br>
> DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)<br>
>     : Asm(A), MMI(Asm->MMI), FirstCU(nullptr), PrevLabel(nullptr),<br>
> -      GlobalRangeCount(0), InfoHolder(A, "info_string", DIEValueAllocator),<br>
> +      GlobalRangeCount(0),<br>
> +      InfoHolder(A, *this, "info_string", DIEValueAllocator),<br>
>       UsedNonDefaultText(false),<br>
> -      SkeletonHolder(A, "skel_string", DIEValueAllocator),<br>
> +      SkeletonHolder(A, *this, "skel_string", DIEValueAllocator),<br>
>       IsDarwin(Triple(A->getTargetTriple()).isOSDarwin()),<br>
>       AccelNames(DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset,<br>
>                                        dwarf::DW_FORM_data4)),<br>
> @@ -1522,7 +1523,7 @@ void DwarfDebug::emitDIE(DIE &Die) {<br>
> void DwarfDebug::emitDebugInfo() {<br>
>   DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;<br>
><br>
> -  Holder.emitUnits(this, DwarfAbbrevSectionSym);<br>
> +  Holder.emitUnits(DwarfAbbrevSectionSym);<br>
> }<br>
><br>
> // Emit the abbreviation section.<br>
> @@ -2165,7 +2166,7 @@ void DwarfDebug::emitDebugInfoDWO() {<br>
>   assert(useSplitDwarf() && "No split dwarf debug info?");<br>
>   // Don't pass an abbrev symbol, using a constant zero instead so as not to<br>
>   // emit relocations into the dwo file.<br>
> -  InfoHolder.emitUnits(this, /* AbbrevSymbol */ nullptr);<br>
> +  InfoHolder.emitUnits(/* AbbrevSymbol */ nullptr);<br>
> }<br>
><br>
> // Emit the .debug_abbrev.dwo section for separated dwarf. This contains the<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp?rev=220452&r1=220451&r2=220452&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp?rev=220452&r1=220451&r2=220452&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp Wed Oct 22 19:16:03 2014<br>
> @@ -18,8 +18,11 @@<br>
> #include "llvm/Target/TargetLoweringObjectFile.h"<br>
><br>
> namespace llvm {<br>
> -DwarfFile::DwarfFile(AsmPrinter *AP, StringRef Pref, BumpPtrAllocator &DA)<br>
> -    : Asm(AP), StrPool(DA, *Asm, Pref) {}<br>
> +DwarfFile::DwarfFile(AsmPrinter *AP, DwarfDebug &DD, StringRef Pref,<br>
> +                     BumpPtrAllocator &DA)<br>
> +    : Asm(AP), DD(DD), StrPool(DA, *Asm, Pref) {<br>
> +  (void)this->DD;<br>
<br>
</div></div>Is this last line in any way necessary?<br></blockquote><div><br>No, not at all - removed in r220487. It was in there from a previous iteration where I had this split into two patches (one to add DwarfDebug to DwarfFile - which produced an -Wunused-member-variable warning, then another patch to use it - when I realized there was an obvious existing use for it (rather than the new use I was about to add) I just rolled those two together so there was a use in the initial patch, and thus no warning to suppress - but forgot to remove the explicit suppression)<br><br>Thanks for the catch!<br>- David<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Fred<br>
<div class="HOEnZb"><div class="h5"><br>
> +}<br>
><br>
> DwarfFile::~DwarfFile() {}<br>
><br>
> @@ -48,7 +51,7 @@ void DwarfFile::addUnit(std::unique_ptr<<br>
><br>
> // Emit the various dwarf units to the unit section USection with<br>
> // the abbreviations going into ASection.<br>
> -void DwarfFile::emitUnits(DwarfDebug *DD, const MCSymbol *ASectionSym) {<br>
> +void DwarfFile::emitUnits(const MCSymbol *ASectionSym) {<br>
>   for (const auto &TheU : CUs) {<br>
>     DIE &Die = TheU->getUnitDie();<br>
>     const MCSection *USection = TheU->getSection();<br>
> @@ -63,7 +66,7 @@ void DwarfFile::emitUnits(DwarfDebug *DD<br>
><br>
>     TheU->emitHeader(ASectionSym);<br>
><br>
> -    DD->emitDIE(Die);<br>
> +    DD.emitDIE(Die);<br>
>     Asm->OutStreamer.EmitLabel(TheU->getLabelEnd());<br>
>   }<br>
> }<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h?rev=220452&r1=220451&r2=220452&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h?rev=220452&r1=220451&r2=220452&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h Wed Oct 22 19:16:03 2014<br>
> @@ -35,6 +35,8 @@ class DwarfFile {<br>
>   // Target of Dwarf emission, used for sizing of abbreviations.<br>
>   AsmPrinter *Asm;<br>
><br>
> +  DwarfDebug &DD;<br>
> +<br>
>   // Used to uniquely define abbreviations.<br>
>   FoldingSet<DIEAbbrev> AbbreviationsSet;<br>
><br>
> @@ -47,7 +49,8 @@ class DwarfFile {<br>
>   DwarfStringPool StrPool;<br>
><br>
> public:<br>
> -  DwarfFile(AsmPrinter *AP, StringRef Pref, BumpPtrAllocator &DA);<br>
> +  DwarfFile(AsmPrinter *AP, DwarfDebug &DD, StringRef Pref,<br>
> +            BumpPtrAllocator &DA);<br>
><br>
>   ~DwarfFile();<br>
><br>
> @@ -67,7 +70,7 @@ public:<br>
><br>
>   /// \brief Emit all of the units to the section listed with the given<br>
>   /// abbreviation section.<br>
> -  void emitUnits(DwarfDebug *DD, const MCSymbol *ASectionSym);<br>
> +  void emitUnits(const MCSymbol *ASectionSym);<br>
><br>
>   /// \brief Emit a set of abbreviations to the specific section.<br>
>   void emitAbbrevs(const MCSection *);<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>
<br>
</div></div></blockquote></div><br></div></div>