Skip to content

Commit

Permalink
Roll DbgVariable::setMInsn into the constructor. No functional changes.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209920 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
adrian-prantl committed May 30, 2014
1 parent 26476d3 commit e457dc7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
6 changes: 2 additions & 4 deletions lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1176,15 +1176,13 @@ DwarfDebug::collectVariableInfo(SmallPtrSet<const MDNode *, 16> &Processed) {
const MachineInstr *MInsn = Ranges.front().first;
assert(MInsn->isDebugValue() && "History must begin with debug value");
DbgVariable *AbsVar = findAbstractVariable(DV, MInsn->getDebugLoc());
DbgVariable *RegVar = new DbgVariable(DV, AbsVar, this);
DbgVariable *RegVar = new DbgVariable(MInsn, AbsVar, this);
if (!addCurrentFnArgument(RegVar, Scope))
addScopeVariable(Scope, RegVar);

// Check if the first DBG_VALUE is valid for the rest of the function.
if (Ranges.size() == 1 && Ranges.front().second == nullptr) {
RegVar->setMInsn(MInsn);
if (Ranges.size() == 1 && Ranges.front().second == nullptr)
continue;
}

// Handle multiple DBG_VALUE instructions describing one variable.
RegVar->setDotDebugLocOffset(DotDebugLocEntries.size());
Expand Down
17 changes: 13 additions & 4 deletions lib/CodeGen/AsmPrinter/DwarfDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/CodeGen/LexicalScopes.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/MC/MachineLocation.h"
Expand Down Expand Up @@ -77,11 +78,20 @@ class DbgVariable {
DwarfDebug *DD;

public:
// AbsVar may be NULL.
DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD)
: Var(V), TheDIE(nullptr), DotDebugLocOffset(~0U), AbsVar(AV),
/// Construct a DbgVariable from a DIVariable.
/// AbstractVar may be NULL.
DbgVariable(DIVariable V, DbgVariable *AbstractVar, DwarfDebug *DD)
: Var(V), TheDIE(nullptr), DotDebugLocOffset(~0U), AbsVar(AbstractVar),
MInsn(nullptr), FrameIndex(~0), DD(DD) {}

/// Construct a DbgVariable from a DEBUG_VALUE.
/// AbstractVar may be NULL.
DbgVariable(const MachineInstr *DbgValue, DbgVariable *AbstractVar,
DwarfDebug *DD)
: Var(DbgValue->getDebugVariable()),
TheDIE(nullptr), DotDebugLocOffset(~0U), AbsVar(AbstractVar),
MInsn(DbgValue), FrameIndex(~0), DD(DD) {}

// Accessors.
DIVariable getVariable() const { return Var; }
void setDIE(DIE &D) { TheDIE = &D; }
Expand All @@ -91,7 +101,6 @@ class DbgVariable {
StringRef getName() const { return Var.getName(); }
DbgVariable *getAbstractVariable() const { return AbsVar; }
const MachineInstr *getMInsn() const { return MInsn; }
void setMInsn(const MachineInstr *M) { MInsn = M; }
int getFrameIndex() const { return FrameIndex; }
void setFrameIndex(int FI) { FrameIndex = FI; }
// Translate tag to proper Dwarf tag.
Expand Down

0 comments on commit e457dc7

Please sign in to comment.