Add getDebugLocTuple to retrieve the DebugLocTuple for a given DebugLoc object.
authorBill Wendling <isanbard@gmail.com>
Tue, 3 Feb 2009 22:49:58 +0000 (22:49 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 3 Feb 2009 22:49:58 +0000 (22:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63676 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineFunction.h
lib/CodeGen/MachineFunction.cpp

index 6abedb50b3c249ab8d9c487ca933e713b48bbee9..b1536a8f75257e8cda7e1a4ee54cd72aa3d50ce9 100644 (file)
@@ -313,9 +313,12 @@ public:
   //
 
   /// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given
-  /// source file, line, and column. If none currently exists, create add a new
-  /// new DebugLocTuple and insert it into the DebugIdMap.
+  /// source file, line, and column. If none currently exists, create a new
+  /// DebugLocTuple, and insert it into the DebugIdMap.
   unsigned getOrCreateDebugLocID(unsigned Src, unsigned Line, unsigned Col);
+
+  /// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object.
+  const DebugLocTuple &getDebugLocTuple(DebugLoc DL);
 };
 
 //===--------------------------------------------------------------------===//
index 434034b888f04af14163def35df34cd275bc2edf..fc9aa843e7889413d2e0c22f0a6b366ae64dac7b 100644 (file)
@@ -380,11 +380,11 @@ MachineFunction& MachineFunction::get(const Function *F)
 }
 
 /// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given
-/// source file, line, and column. If none currently exists, create add a new
-/// new DebugLocTuple and insert it into the DebugIdMap.
+/// source file, line, and column. If none currently exists, create a new
+/// DebugLocTuple, and insert it into the DebugIdMap.
 unsigned MachineFunction::getOrCreateDebugLocID(unsigned Src, unsigned Line,
                                                 unsigned Col) {
-  struct DebugLocTuple Tuple(Src, Line, Col);
+  DebugLocTuple Tuple(Src, Line, Col);
   DenseMap<DebugLocTuple, unsigned>::iterator II
     = DebugLocInfo.DebugIdMap.find(Tuple);
   if (II != DebugLocInfo.DebugIdMap.end())
@@ -396,6 +396,14 @@ unsigned MachineFunction::getOrCreateDebugLocID(unsigned Src, unsigned Line,
   return Id;
 }
 
+/// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object.
+const DebugLocTuple &MachineFunction::getDebugLocTuple(DebugLoc DL) {
+  unsigned Idx;
+  assert(Idx < DebugLocInfo.DebugLocations.size() &&
+         "Invalid index into debug locations!");
+  return DebugLocInfo.DebugLocations[Idx];
+}
+
 //===----------------------------------------------------------------------===//
 //  MachineFrameInfo implementation
 //===----------------------------------------------------------------------===//