diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-04-21 20:13:09 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-04-21 20:13:09 +0000 |
commit | b0b7b18e8cb64fcb9f16bfee9b4cad0025d01ae4 (patch) | |
tree | f41bdea1dd63e89774cb91b4e6b8e56375cfeaff /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | |
parent | 20352216fbdac770fd0685b9d8dc1fbd5387eb47 (diff) | |
download | bcm5719-llvm-b0b7b18e8cb64fcb9f16bfee9b4cad0025d01ae4.tar.gz bcm5719-llvm-b0b7b18e8cb64fcb9f16bfee9b4cad0025d01ae4.zip |
Use value semantics to manage DbgVariables rather than dynamic allocation/pointers.
Requires switching some vectors to lists to maintain pointer validity.
These could be changed to forward_lists (singly linked) with a bit more
work - I've left comments to that effect.
llvm-svn: 206780
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index 8c4514e615e..0c1922ed3aa 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 <list> + namespace llvm { class AsmPrinter; @@ -274,7 +276,9 @@ class DwarfDebug : public AsmPrinterHandler { SectionMapType SectionMap; // List of arguments for current function. - SmallVector<DbgVariable *, 8> CurrentFnArguments; + // Linked list use to maintain pointer validity. Singly linked list could + // suffice with some contortions to addCurrentFnArgument. + std::list<DbgVariable> CurrentFnArguments; LexicalScopes LScopes; @@ -282,7 +286,9 @@ class DwarfDebug : public AsmPrinterHandler { DenseMap<const MDNode *, DIE *> AbstractSPDies; // Collection of dbg variables of a scope. - typedef DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8> > + // Linked list use to maintain pointer validity. Singly linked list could + // suffice with some contortions to addScopeVariable. + typedef DenseMap<LexicalScope *, std::list<DbgVariable>> ScopeVariablesMap; ScopeVariablesMap ScopeVariables; @@ -413,7 +419,7 @@ class DwarfDebug : public AsmPrinterHandler { MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &); - void addScopeVariable(LexicalScope *LS, DbgVariable *Var); + DbgVariable &addScopeVariable(LexicalScope *LS, DbgVariable Var); const SmallVectorImpl<DwarfUnit *> &getUnits() { return InfoHolder.getUnits(); @@ -591,7 +597,9 @@ class DwarfDebug : public AsmPrinterHandler { /// \brief If Var is an current function argument that add it in /// CurrentFnArguments list. - bool addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope); + DbgVariable *addCurrentFnArgument(DbgVariable &Var, LexicalScope *Scope); + + DbgVariable &addVariable(DbgVariable Var, LexicalScope *Scope); /// \brief Populate LexicalScope entries with variables' info. void collectVariableInfo(SmallPtrSet<const MDNode *, 16> &ProcessedVars); |