Replace DebugLocTuple with DILocation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93630 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index ae59f9c..ed6ccec 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -61,8 +61,7 @@
     // FIXME: Pass instprinter to streamer.
     OutStreamer(*createAsmStreamer(OutContext, O, *T, 0)),
 
-    LastMI(0), LastFn(0), Counter(~0U),
-    PrevDLT(0, 0, ~0U, ~0U) {
+    LastMI(0), LastFn(0), Counter(~0U), PrevDLT(NULL) {
   DW = 0; MMI = 0;
   switch (AsmVerbose) {
   case cl::BOU_UNSET: VerboseAsm = VDef;  break;
@@ -1406,14 +1405,15 @@
   DebugLoc DL = MI->getDebugLoc();
   if (DL.isUnknown())
     return;
-  DebugLocTuple CurDLT = MF->getDebugLocTuple(DL);
-  if (CurDLT.Scope == 0)
+  DILocation CurDLT = MF->getDILocation(DL);
+  if (CurDLT.getScope().isNull())
     return;
 
   if (BeforePrintingInsn) {
-    if (CurDLT != PrevDLT) {
-      unsigned L = DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,
-                                        CurDLT.Scope);
+    if (CurDLT.getNode() != PrevDLT.getNode()) {
+      unsigned L = DW->RecordSourceLine(CurDLT.getLineNumber(), 
+                                        CurDLT.getColumnNumber(),
+                                        CurDLT.getScope().getNode());
       printLabel(L);
       O << '\n';
       DW->BeginScope(MI, L);
@@ -1910,20 +1910,20 @@
   bool Newline = false;
 
   if (!MI.getDebugLoc().isUnknown()) {
-    DebugLocTuple DLT = MF->getDebugLocTuple(MI.getDebugLoc());
+    DILocation DLT = MF->getDILocation(MI.getDebugLoc());
 
     // Print source line info.
     O.PadToColumn(MAI->getCommentColumn());
     O << MAI->getCommentString() << ' ';
-    DIScope Scope(DLT.Scope);
+    DIScope Scope = DLT.getScope();
     // Omit the directory, because it's likely to be long and uninteresting.
     if (!Scope.isNull())
       O << Scope.getFilename();
     else
       O << "<unknown>";
-    O << ':' << DLT.Line;
-    if (DLT.Col != 0)
-      O << ':' << DLT.Col;
+    O << ':' << DLT.getLineNumber();
+    if (DLT.getColumnNumber() != 0)
+      O << ':' << DLT.getColumnNumber();
     Newline = true;
   }
 
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 1043fa8..8725c59 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2001,13 +2001,14 @@
       MIIndexMap[MInsn] = MIIndex++;
       DebugLoc DL = MInsn->getDebugLoc();
       if (DL.isUnknown()) continue;
-      DebugLocTuple DLT = MF->getDebugLocTuple(DL);
-      if (!DLT.Scope) continue;
+      DILocation DLT = MF->getDILocation(DL);
+      DIScope DLTScope = DLT.getScope();
+      if (DLTScope.isNull()) continue;
       // There is no need to create another DIE for compile unit. For all
       // other scopes, create one DbgScope now. This will be translated
       // into a scope DIE at the end.
-      if (DIDescriptor(DLT.Scope).isCompileUnit()) continue;
-      createDbgScope(DLT.Scope, DLT.InlinedAtLoc);
+      if (DLTScope.isCompileUnit()) continue;
+      createDbgScope(DLTScope.getNode(), DLT.getOrigLocation().getNode());
     }
   }
 
@@ -2020,13 +2021,15 @@
       const MachineInstr *MInsn = II;
       DebugLoc DL = MInsn->getDebugLoc();
       if (DL.isUnknown())  continue;
-      DebugLocTuple DLT = MF->getDebugLocTuple(DL);
-      if (!DLT.Scope)  continue;
+      DILocation DLT = MF->getDILocation(DL);
+      DIScope DLTScope = DLT.getScope();
+      if (DLTScope.isNull())  continue;
       // There is no need to create another DIE for compile unit. For all
       // other scopes, create one DbgScope now. This will be translated
       // into a scope DIE at the end.
-      if (DIDescriptor(DLT.Scope).isCompileUnit()) continue;
-      DbgScope *Scope = getUpdatedDbgScope(DLT.Scope, MInsn, DLT.InlinedAtLoc);
+      if (DLTScope.isCompileUnit()) continue;
+      DbgScope *Scope = getUpdatedDbgScope(DLTScope.getNode(), MInsn, 
+                                           DLT.getOrigLocation().getNode());
       Scope->setLastInsn(MInsn);
     }
   }
@@ -2091,13 +2094,16 @@
   // function.
   DebugLoc FDL = MF->getDefaultDebugLoc();
   if (!FDL.isUnknown()) {
-    DebugLocTuple DLT = MF->getDebugLocTuple(FDL);
+    DILocation DLT = MF->getDILocation(FDL);
     unsigned LabelID = 0;
-    DISubprogram SP = getDISubprogram(DLT.Scope);
+    DISubprogram SP = getDISubprogram(DLT.getScope().getNode());
     if (!SP.isNull())
-      LabelID = recordSourceLine(SP.getLineNumber(), 0, DLT.Scope);
+      LabelID = recordSourceLine(SP.getLineNumber(), 0, 
+                                 DLT.getScope().getNode());
     else
-      LabelID = recordSourceLine(DLT.Line, DLT.Col, DLT.Scope);
+      LabelID = recordSourceLine(DLT.getLineNumber(), 
+                                 DLT.getColumnNumber(), 
+                                 DLT.getScope().getNode());
     Asm->printLabel(LabelID);
     O << '\n';
   }
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp
index ae9451c..85c4540 100644
--- a/lib/CodeGen/MachineFunction.cpp
+++ b/lib/CodeGen/MachineFunction.cpp
@@ -426,12 +426,12 @@
   return VReg;
 }
 
-/// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object.
-DebugLocTuple MachineFunction::getDebugLocTuple(DebugLoc DL) const {
+/// getDILocation - Get the DILocation for a given DebugLoc object.
+DILocation MachineFunction::getDILocation(DebugLoc DL) const {
   unsigned Idx = DL.getIndex();
   assert(Idx < DebugLocInfo.DebugLocations.size() &&
          "Invalid index into debug locations!");
-  return DebugLocInfo.DebugLocations[Idx];
+  return DILocation(DebugLocInfo.DebugLocations[Idx]);
 }
 
 //===----------------------------------------------------------------------===//
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index cf3e3e1..d58a0fb 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -1189,17 +1189,17 @@
 
     // TODO: print InlinedAtLoc information
 
-    DebugLocTuple DLT = MF->getDebugLocTuple(debugLoc);
-    DIScope Scope(DLT.Scope);
+    DILocation DLT = MF->getDILocation(debugLoc);
+    DIScope Scope = DLT.getScope();
     OS << " dbg:";
     // Omit the directory, since it's usually long and uninteresting.
     if (!Scope.isNull())
       OS << Scope.getFilename();
     else
       OS << "<unknown>";
-    OS << ':' << DLT.Line;
-    if (DLT.Col != 0)
-      OS << ':' << DLT.Col;
+    OS << ':' << DLT.getLineNumber();
+    if (DLT.getColumnNumber() != 0)
+      OS << ':' << DLT.getColumnNumber();
   }
 
   OS << "\n";