mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206780 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user