From a97906b6e6e85934d6cb71ddf3ca9bb72fe66695 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 17 Oct 2006 23:16:42 +0000 Subject: [PATCH] add a method to remove a line # record. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31025 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineDebugInfo.h | 5 +++++ lib/CodeGen/MachineDebugInfo.cpp | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/llvm/CodeGen/MachineDebugInfo.h b/include/llvm/CodeGen/MachineDebugInfo.h index a031ad0c6f6..c1134d06afb 100644 --- a/include/llvm/CodeGen/MachineDebugInfo.h +++ b/include/llvm/CodeGen/MachineDebugInfo.h @@ -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, diff --git a/lib/CodeGen/MachineDebugInfo.cpp b/lib/CodeGen/MachineDebugInfo.cpp index a227589e1e8..7ca63b0ba48 100644 --- a/lib/CodeGen/MachineDebugInfo.cpp +++ b/lib/CodeGen/MachineDebugInfo.cpp @@ -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::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, -- 2.34.1