From e457dc7ceb531fd9cc394b504ea7fde0b8d9d2e2 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 30 May 2014 21:10:13 +0000 Subject: [PATCH 1/1] Roll DbgVariable::setMInsn into the constructor. No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209920 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 6 ++---- lib/CodeGen/AsmPrinter/DwarfDebug.h | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 66ba9298c40..b2ae9ad36da 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1176,15 +1176,13 @@ DwarfDebug::collectVariableInfo(SmallPtrSet &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()); diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index 2f5abc829ea..2d673791102 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -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" @@ -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; } @@ -91,7 +101,6 @@ public: 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. -- 2.34.1