[llvm] r209920 - Roll DbgVariable::setMInsn into the constructor. No functional changes.

Adrian Prantl aprantl at apple.com
Fri May 30 14:10:13 PDT 2014


Author: adrian
Date: Fri May 30 16:10:13 2014
New Revision: 209920

URL: http://llvm.org/viewvc/llvm-project?rev=209920&view=rev
Log:
Roll DbgVariable::setMInsn into the constructor. No functional changes.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=209920&r1=209919&r2=209920&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri May 30 16:10:13 2014
@@ -1176,15 +1176,13 @@ DwarfDebug::collectVariableInfo(SmallPtr
     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());

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=209920&r1=209919&r2=209920&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Fri May 30 16:10:13 2014
@@ -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.





More information about the llvm-commits mailing list