diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-04-22 22:39:41 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-04-22 22:39:41 +0000 |
commit | f9b6a558c8cf514eaef8914e5ef0ed3bb0707868 (patch) | |
tree | 3e11edf06ac80d1bd9355d97a144bee71db19d46 /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | |
parent | 3feb690f76dec261ae79fc09b3603522e91e6ed6 (diff) | |
download | bcm5719-llvm-f9b6a558c8cf514eaef8914e5ef0ed3bb0707868.tar.gz bcm5719-llvm-f9b6a558c8cf514eaef8914e5ef0ed3bb0707868.zip |
Push memory ownership of DwarfUnits into clients of DwarfFile.
This prompted me to push references through most of DwarfDebug. Sorry
for the churn.
Honestly it's a bit silly that we're passing around units all over the
place like that anyway and I think it's mostly due to the DIE attribute
adding utility functions being utilities in DwarfUnit. I should have
another go at moving them out of DwarfUnit...
llvm-svn: 206925
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index 521a62310ae..bbfb27f886e 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -30,6 +30,8 @@ #include "llvm/MC/MCDwarf.h" #include "llvm/Support/Allocator.h" +#include <memory> + namespace llvm { class AsmPrinter; @@ -184,7 +186,7 @@ public: void assignAbbrevNumber(DIEAbbrev &Abbrev); /// \brief Add a unit to the list of CUs. - void addUnit(DwarfUnit *CU); + void addUnit(std::unique_ptr<DwarfUnit> U); /// \brief Emit all of the units to the section listed with the given /// abbreviation section. @@ -423,7 +425,7 @@ class DwarfDebug : public AsmPrinterHandler { /// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global /// variables in this scope then create and insert DIEs for these /// variables. - DIE *updateSubprogramScopeDIE(DwarfCompileUnit *SPCU, DISubprogram SP); + DIE *updateSubprogramScopeDIE(DwarfCompileUnit &SPCU, DISubprogram SP); /// \brief A helper function to check whether the DIE for a given Scope is /// going to be null. @@ -431,21 +433,21 @@ class DwarfDebug : public AsmPrinterHandler { /// \brief A helper function to construct a RangeSpanList for a given /// lexical scope. - void addScopeRangeList(DwarfCompileUnit *TheCU, DIE *ScopeDIE, + void addScopeRangeList(DwarfCompileUnit &TheCU, DIE *ScopeDIE, const SmallVectorImpl<InsnRange> &Range); /// \brief Construct new DW_TAG_lexical_block for this scope and /// attach DW_AT_low_pc/DW_AT_high_pc labels. - DIE *constructLexicalScopeDIE(DwarfCompileUnit *TheCU, LexicalScope *Scope); + DIE *constructLexicalScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope); /// \brief This scope represents inlined body of a function. Construct /// DIE to represent this concrete inlined copy of the function. - DIE *constructInlinedScopeDIE(DwarfCompileUnit *TheCU, LexicalScope *Scope); + DIE *constructInlinedScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope); /// \brief Construct a DIE for this scope. - DIE *constructScopeDIE(DwarfCompileUnit *TheCU, LexicalScope *Scope); + DIE *constructScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope); /// A helper function to create children of a Scope DIE. - DIE *createScopeChildrenDIE(DwarfCompileUnit *TheCU, LexicalScope *Scope, + DIE *createScopeChildrenDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope, SmallVectorImpl<DIE *> &Children); /// \brief Emit initial Dwarf sections with a label at the start of each one. @@ -532,15 +534,16 @@ class DwarfDebug : public AsmPrinterHandler { /// DWARF 5 Experimental Split Dwarf Emitters /// \brief Initialize common features of skeleton units. - void initSkeletonUnit(const DwarfUnit *U, DIE *Die, DwarfUnit *NewU); + void initSkeletonUnit(const DwarfUnit &U, DIE *Die, + std::unique_ptr<DwarfUnit> NewU); /// \brief Construct the split debug info compile unit for the debug info /// section. - DwarfCompileUnit *constructSkeletonCU(const DwarfCompileUnit *CU); + DwarfCompileUnit &constructSkeletonCU(const DwarfCompileUnit &CU); /// \brief Construct the split debug info compile unit for the debug info /// section. - DwarfTypeUnit *constructSkeletonTU(DwarfTypeUnit *TU); + DwarfTypeUnit &constructSkeletonTU(DwarfTypeUnit &TU); /// \brief Emit the debug info dwo section. void emitDebugInfoDWO(); @@ -556,24 +559,24 @@ class DwarfDebug : public AsmPrinterHandler { /// Flags to let the linker know we have emitted new style pubnames. Only /// emit it here if we don't have a skeleton CU for split dwarf. - void addGnuPubAttributes(DwarfUnit *U, DIE *D) const; + void addGnuPubAttributes(DwarfUnit &U, DIE *D) const; /// \brief Create new DwarfCompileUnit for the given metadata node with tag /// DW_TAG_compile_unit. - DwarfCompileUnit *constructDwarfCompileUnit(DICompileUnit DIUnit); + DwarfCompileUnit &constructDwarfCompileUnit(DICompileUnit DIUnit); /// \brief Construct subprogram DIE. - void constructSubprogramDIE(DwarfCompileUnit *TheCU, const MDNode *N); + void constructSubprogramDIE(DwarfCompileUnit &TheCU, const MDNode *N); /// \brief Construct imported_module or imported_declaration DIE. - void constructImportedEntityDIE(DwarfCompileUnit *TheCU, const MDNode *N); + void constructImportedEntityDIE(DwarfCompileUnit &TheCU, const MDNode *N); /// \brief Construct import_module DIE. - void constructImportedEntityDIE(DwarfCompileUnit *TheCU, const MDNode *N, + void constructImportedEntityDIE(DwarfCompileUnit &TheCU, const MDNode *N, DIE *Context); /// \brief Construct import_module DIE. - void constructImportedEntityDIE(DwarfCompileUnit *TheCU, + void constructImportedEntityDIE(DwarfCompileUnit &TheCU, const DIImportedEntity &Module, DIE *Context); /// \brief Register a source line with debug info. Returns the unique @@ -613,7 +616,7 @@ class DwarfDebug : public AsmPrinterHandler { /// \brief Return Label immediately following the instruction. MCSymbol *getLabelAfterInsn(const MachineInstr *MI); - void attachLowHighPC(DwarfCompileUnit *Unit, DIE *D, MCSymbol *Begin, + void attachLowHighPC(DwarfCompileUnit &Unit, DIE *D, MCSymbol *Begin, MCSymbol *End); public: |