add a method to remove a line # record.
authorChris Lattner <sabre@nondot.org>
Tue, 17 Oct 2006 23:16:42 +0000 (23:16 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 17 Oct 2006 23:16:42 +0000 (23:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31025 91177308-0d34-0410-b5e6-96231b3b80d8

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

index a031ad0c6f6378eec2713d3a431ffefb315ecd7c..c1134d06afb23f13bbbbf44cc11a32a115fda590 100644 (file)
@@ -1029,6 +1029,11 @@ public:
   /// provide correspondence to the source line list.
   unsigned RecordLabel(unsigned Line, unsigned Column, unsigned Source);
   
+  /// RemoveLabelInfo - Remove the specified label # from MachineDebugInfo, for
+  /// example because the code was deleted.
+  void RemoveLabelInfo(unsigned LabelUID);
+  
+  
   /// RecordSource - Register a source file with debug info. Returns an source
   /// ID.
   unsigned RecordSource(const std::string &Directory,
index a227589e1e87b06bdd9e9252994f8325b824f371..7ca63b0ba48b5e9c0562e22398677de13fcd5d7f 100644 (file)
@@ -1542,6 +1542,20 @@ unsigned MachineDebugInfo::RecordLabel(unsigned Line, unsigned Column,
   return ID;
 }
 
+static bool LabelUIDComparison(const SourceLineInfo &LI, unsigned UID) {
+  return LI.getLabelID() < UID;
+}
+
+/// RemoveLabelInfo - Remove the specified label # from MachineDebugInfo, for
+/// example because the code was deleted.
+void MachineDebugInfo::RemoveLabelInfo(unsigned LabelUID) {
+  std::vector<SourceLineInfo>::iterator I =
+    std::lower_bound(Lines.begin(), Lines.end(), LabelUID, LabelUIDComparison);
+  assert(I != Lines.end() && "Didn't find label UID in MachineDebugInfo!");
+  Lines.erase(I);
+}
+
+
 /// RecordSource - Register a source file with debug info. Returns an source
 /// ID.
 unsigned MachineDebugInfo::RecordSource(const std::string &Directory,