Make DotDebugLocEntry a class, reorder the members along with comments
authorEric Christopher <echristo@gmail.com>
Wed, 3 Jul 2013 22:40:18 +0000 (22:40 +0000)
committerEric Christopher <echristo@gmail.com>
Wed, 3 Jul 2013 22:40:18 +0000 (22:40 +0000)
for them and update all uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185588 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h

index 1168e27a01315c33f4f724b4b0ac91b275942c56..2ad17f4511e0f74f7dfb0b236e3914d79aba9a15 100644 (file)
@@ -2440,9 +2440,9 @@ void DwarfDebug::emitDebugLoc() {
       Asm->OutStreamer.EmitIntValue(0, Size);
       Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", index));
     } else {
-      Asm->OutStreamer.EmitSymbolValue(Entry.Begin, Size);
-      Asm->OutStreamer.EmitSymbolValue(Entry.End, Size);
-      DIVariable DV(Entry.Variable);
+      Asm->OutStreamer.EmitSymbolValue(Entry.getBeginSym(), Size);
+      Asm->OutStreamer.EmitSymbolValue(Entry.getEndSym(), Size);
+      DIVariable DV(Entry.getVariable());
       Asm->OutStreamer.AddComment("Loc expr size");
       MCSymbol *begin = Asm->OutStreamer.getContext().CreateTempSymbol();
       MCSymbol *end = Asm->OutStreamer.getContext().CreateTempSymbol();
@@ -2464,15 +2464,15 @@ void DwarfDebug::emitDebugLoc() {
       } else if (Entry.isLocation()) {
         if (!DV.hasComplexAddress())
           // Regular entry.
-          Asm->EmitDwarfRegOp(Entry.Loc, DV.isIndirect());
+          Asm->EmitDwarfRegOp(Entry.getLoc(), DV.isIndirect());
         else {
           // Complex address entry.
           unsigned N = DV.getNumAddrElements();
           unsigned i = 0;
           if (N >= 2 && DV.getAddrElement(0) == DIBuilder::OpPlus) {
-            if (Entry.Loc.getOffset()) {
+            if (Entry.getLoc().getOffset()) {
               i = 2;
-              Asm->EmitDwarfRegOp(Entry.Loc, DV.isIndirect());
+              Asm->EmitDwarfRegOp(Entry.getLoc(), DV.isIndirect());
               Asm->OutStreamer.AddComment("DW_OP_deref");
               Asm->EmitInt8(dwarf::DW_OP_deref);
               Asm->OutStreamer.AddComment("DW_OP_plus_uconst");
@@ -2481,12 +2481,12 @@ void DwarfDebug::emitDebugLoc() {
             } else {
               // If first address element is OpPlus then emit
               // DW_OP_breg + Offset instead of DW_OP_reg + Offset.
-              MachineLocation Loc(Entry.Loc.getReg(), DV.getAddrElement(1));
+              MachineLocation Loc(Entry.getLoc().getReg(), DV.getAddrElement(1));
               Asm->EmitDwarfRegOp(Loc, DV.isIndirect());
               i = 2;
             }
           } else {
-            Asm->EmitDwarfRegOp(Entry.Loc, DV.isIndirect());
+            Asm->EmitDwarfRegOp(Entry.getLoc(), DV.isIndirect());
           }
 
           // Emit remaining complex address elements.
@@ -2496,7 +2496,7 @@ void DwarfDebug::emitDebugLoc() {
               Asm->EmitInt8(dwarf::DW_OP_plus_uconst);
               Asm->EmitULEB128(DV.getAddrElement(++i));
             } else if (Element == DIBuilder::OpDeref) {
-              if (!Entry.Loc.isReg())
+              if (!Entry.getLoc().isReg())
                 Asm->EmitInt8(dwarf::DW_OP_deref);
             } else
               llvm_unreachable("unknown Opcode found in complex address");
index a06a3b4195f83fb749c0e921b747c8298325003f..2d2467a0d2b29c7641c01eda240b7495663a9490 100644 (file)
@@ -62,12 +62,12 @@ public:
 
 /// \brief This struct describes location entries emitted in the .debug_loc
 /// section.
-typedef struct DotDebugLocEntry {
+class DotDebugLocEntry {
+  // Begin and end symbols for the address range that this location is valid.
   const MCSymbol *Begin;
   const MCSymbol *End;
-  MachineLocation Loc;
-  const MDNode *Variable;
-  bool Merged;
+
+  // Type of entry that this represents.
   enum EntryType {
     E_Location,
     E_Integer,
@@ -81,6 +81,17 @@ typedef struct DotDebugLocEntry {
     const ConstantFP *CFP;
     const ConstantInt *CIP;
   } Constants;
+
+  // The location in the machine frame.
+  MachineLocation Loc;
+
+  // The variable to which this location entry corresponds.
+  const MDNode *Variable;
+
+  // Whether this location has been merged.
+  bool Merged;
+
+public:
   DotDebugLocEntry() : Begin(0), End(0), Variable(0), Merged(false) {
     Constants.Int = 0;
   }
@@ -124,7 +135,11 @@ typedef struct DotDebugLocEntry {
   int64_t getInt() const                    { return Constants.Int; }
   const ConstantFP *getConstantFP() const   { return Constants.CFP; }
   const ConstantInt *getConstantInt() const { return Constants.CIP; }
-} DotDebugLocEntry;
+  const MDNode *getVariable() const { return Variable; }
+  const MCSymbol *getBeginSym() const { return Begin; }
+  const MCSymbol *getEndSym() const { return End; }
+  MachineLocation getLoc() const { return Loc; }
+};
 
 //===----------------------------------------------------------------------===//
 /// \brief This class is used to track local variable information.