[Lldb-commits] [lldb] 159641d - [lldb] Use llvm range functions in LineTable.cpp

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 3 07:21:16 PST 2019


Author: Pavel Labath
Date: 2019-12-03T16:22:52+01:00
New Revision: 159641d710b074b6d89e3aced179f9a2229e4eb0

URL: https://github.com/llvm/llvm-project/commit/159641d710b074b6d89e3aced179f9a2229e4eb0
DIFF: https://github.com/llvm/llvm-project/commit/159641d710b074b6d89e3aced179f9a2229e4eb0.diff

LOG: [lldb] Use llvm range functions in LineTable.cpp

to avoid needing to declare iterators everywhere.

Added: 
    

Modified: 
    lldb/source/Symbol/LineTable.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Symbol/LineTable.cpp b/lldb/source/Symbol/LineTable.cpp
index 1433dc156d91..fecc90c409f2 100644
--- a/lldb/source/Symbol/LineTable.cpp
+++ b/lldb/source/Symbol/LineTable.cpp
@@ -34,11 +34,9 @@ void LineTable::InsertLineEntry(lldb::addr_t file_addr, uint32_t line,
               is_start_of_basic_block, is_prologue_end, is_epilogue_begin,
               is_terminal_entry);
 
-  entry_collection::iterator begin_pos = m_entries.begin();
-  entry_collection::iterator end_pos = m_entries.end();
   LineTable::Entry::LessThanBinaryPredicate less_than_bp(this);
   entry_collection::iterator pos =
-      upper_bound(begin_pos, end_pos, entry, less_than_bp);
+      llvm::upper_bound(m_entries, entry, less_than_bp);
 
   //  Stream s(stdout);
   //  s << "\n\nBefore:\n";
@@ -289,8 +287,6 @@ uint32_t LineTable::FindLineEntryIndexByFileIndex(
     uint32_t line, bool exact, LineEntry *line_entry_ptr) {
 
   const size_t count = m_entries.size();
-  std::vector<uint32_t>::const_iterator begin_pos = file_indexes.begin();
-  std::vector<uint32_t>::const_iterator end_pos = file_indexes.end();
   size_t best_match = UINT32_MAX;
 
   for (size_t idx = start_idx; idx < count; ++idx) {
@@ -299,7 +295,7 @@ uint32_t LineTable::FindLineEntryIndexByFileIndex(
     if (m_entries[idx].is_terminal_entry)
       continue;
 
-    if (find(begin_pos, end_pos, m_entries[idx].file_idx) == end_pos)
+    if (llvm::find(file_indexes, m_entries[idx].file_idx) == file_indexes.end())
       continue;
 
     // Exact match always wins.  Otherwise try to find the closest line > the


        


More information about the lldb-commits mailing list