[llvm] r220452 - [DebugInfo] Add DwarfDebug& to DwarfFile.

David Blaikie dblaikie at gmail.com
Thu Oct 23 09:24:58 PDT 2014


On Wed, Oct 22, 2014 at 6:28 PM, Frédéric Riss <friss at apple.com> wrote:

>
> > On 22 Oct 2014, at 17:16, David Blaikie <dblaikie at gmail.com> wrote:
> >
> > Author: dblaikie
> > Date: Wed Oct 22 19:16:03 2014
> > New Revision: 220452
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=220452&view=rev
> > Log:
> > [DebugInfo] Add DwarfDebug& to DwarfFile.
> >
> > Use the DwarfDebug in one function that previously took it as a
> > parameter, and lay the foundation for use this for other operations
> > coming soon.
> >
> > Modified:
> >    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> >    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp
> >    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=220452&r1=220451&r2=220452&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Oct 22 19:16:03
> 2014
> > @@ -170,9 +170,10 @@ static LLVM_CONSTEXPR DwarfAccelTable::A
> >
> > DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
> >     : Asm(A), MMI(Asm->MMI), FirstCU(nullptr), PrevLabel(nullptr),
> > -      GlobalRangeCount(0), InfoHolder(A, "info_string",
> DIEValueAllocator),
> > +      GlobalRangeCount(0),
> > +      InfoHolder(A, *this, "info_string", DIEValueAllocator),
> >       UsedNonDefaultText(false),
> > -      SkeletonHolder(A, "skel_string", DIEValueAllocator),
> > +      SkeletonHolder(A, *this, "skel_string", DIEValueAllocator),
> >       IsDarwin(Triple(A->getTargetTriple()).isOSDarwin()),
> >       AccelNames(DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset,
> >                                        dwarf::DW_FORM_data4)),
> > @@ -1522,7 +1523,7 @@ void DwarfDebug::emitDIE(DIE &Die) {
> > void DwarfDebug::emitDebugInfo() {
> >   DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
> >
> > -  Holder.emitUnits(this, DwarfAbbrevSectionSym);
> > +  Holder.emitUnits(DwarfAbbrevSectionSym);
> > }
> >
> > // Emit the abbreviation section.
> > @@ -2165,7 +2166,7 @@ void DwarfDebug::emitDebugInfoDWO() {
> >   assert(useSplitDwarf() && "No split dwarf debug info?");
> >   // Don't pass an abbrev symbol, using a constant zero instead so as
> not to
> >   // emit relocations into the dwo file.
> > -  InfoHolder.emitUnits(this, /* AbbrevSymbol */ nullptr);
> > +  InfoHolder.emitUnits(/* AbbrevSymbol */ nullptr);
> > }
> >
> > // Emit the .debug_abbrev.dwo section for separated dwarf. This contains
> the
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp?rev=220452&r1=220451&r2=220452&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp Wed Oct 22 19:16:03
> 2014
> > @@ -18,8 +18,11 @@
> > #include "llvm/Target/TargetLoweringObjectFile.h"
> >
> > namespace llvm {
> > -DwarfFile::DwarfFile(AsmPrinter *AP, StringRef Pref, BumpPtrAllocator
> &DA)
> > -    : Asm(AP), StrPool(DA, *Asm, Pref) {}
> > +DwarfFile::DwarfFile(AsmPrinter *AP, DwarfDebug &DD, StringRef Pref,
> > +                     BumpPtrAllocator &DA)
> > +    : Asm(AP), DD(DD), StrPool(DA, *Asm, Pref) {
> > +  (void)this->DD;
>
> Is this last line in any way necessary?
>

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)

Thanks for the catch!
- David


>
> Fred
>
> > +}
> >
> > DwarfFile::~DwarfFile() {}
> >
> > @@ -48,7 +51,7 @@ void DwarfFile::addUnit(std::unique_ptr<
> >
> > // Emit the various dwarf units to the unit section USection with
> > // the abbreviations going into ASection.
> > -void DwarfFile::emitUnits(DwarfDebug *DD, const MCSymbol *ASectionSym) {
> > +void DwarfFile::emitUnits(const MCSymbol *ASectionSym) {
> >   for (const auto &TheU : CUs) {
> >     DIE &Die = TheU->getUnitDie();
> >     const MCSection *USection = TheU->getSection();
> > @@ -63,7 +66,7 @@ void DwarfFile::emitUnits(DwarfDebug *DD
> >
> >     TheU->emitHeader(ASectionSym);
> >
> > -    DD->emitDIE(Die);
> > +    DD.emitDIE(Die);
> >     Asm->OutStreamer.EmitLabel(TheU->getLabelEnd());
> >   }
> > }
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h?rev=220452&r1=220451&r2=220452&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h Wed Oct 22 19:16:03
> 2014
> > @@ -35,6 +35,8 @@ class DwarfFile {
> >   // Target of Dwarf emission, used for sizing of abbreviations.
> >   AsmPrinter *Asm;
> >
> > +  DwarfDebug ⅅ
> > +
> >   // Used to uniquely define abbreviations.
> >   FoldingSet<DIEAbbrev> AbbreviationsSet;
> >
> > @@ -47,7 +49,8 @@ class DwarfFile {
> >   DwarfStringPool StrPool;
> >
> > public:
> > -  DwarfFile(AsmPrinter *AP, StringRef Pref, BumpPtrAllocator &DA);
> > +  DwarfFile(AsmPrinter *AP, DwarfDebug &DD, StringRef Pref,
> > +            BumpPtrAllocator &DA);
> >
> >   ~DwarfFile();
> >
> > @@ -67,7 +70,7 @@ public:
> >
> >   /// \brief Emit all of the units to the section listed with the given
> >   /// abbreviation section.
> > -  void emitUnits(DwarfDebug *DD, const MCSymbol *ASectionSym);
> > +  void emitUnits(const MCSymbol *ASectionSym);
> >
> >   /// \brief Emit a set of abbreviations to the specific section.
> >   void emitAbbrevs(const MCSection *);
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141023/d2d536c0/attachment.html>


More information about the llvm-commits mailing list