No need to keep size of DebugLocations vector separately.
authorEvan Cheng <evan.cheng@apple.com>
Mon, 26 Jan 2009 23:47:30 +0000 (23:47 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Mon, 26 Jan 2009 23:47:30 +0000 (23:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63070 91177308-0d34-0410-b5e6-96231b3b80d8

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

index b6097afe306dbbdd664a91237645c31733324247..baf6583a8ba7ba813fa4d136307e75d8a6cd13a9 100644 (file)
@@ -69,9 +69,6 @@ namespace llvm {
   /// DebugLocTracker - This class tracks debug location information.
   ///
   struct DebugLocTracker {
-    // NumDebugLocations - Size of the DebugLocations vector.
-    unsigned NumDebugLocations;
-
     // DebugLocations - A vector of unique DebugLocTuple's.
     //
     std::vector<DebugLocTuple> DebugLocations;
@@ -80,7 +77,7 @@ namespace llvm {
     // DebugLocations vector.
     DebugIdMapType DebugIdMap;
 
-    DebugLocTracker() : NumDebugLocations(0) {}
+    DebugLocTracker() {}
 
     ~DebugLocTracker() {
       DebugLocations.clear();
index c1ab9afe9f68f18fb1e69ea02fe44cace411a894..abd84ecbd5c353fc13f8e6c920025897b096bb31 100644 (file)
@@ -388,9 +388,10 @@ unsigned MachineFunction::lookUpDebugLocId(unsigned Src, unsigned Line,
   if (II != DebugLocInfo.DebugIdMap.end())
     return II->second;
   // Add a new tuple.
+  unsigned Id = DebugLocInfo.DebugLocations.size();
   DebugLocInfo.DebugLocations.push_back(Tuple);
-  DebugLocInfo.DebugIdMap[Tuple] = DebugLocInfo.NumDebugLocations;
-  return DebugLocInfo.NumDebugLocations++;
+  DebugLocInfo.DebugIdMap[Tuple] = Id;
+  return Id;
 }
 
 //===----------------------------------------------------------------------===//