[Lldb-commits] [PATCH] D56425: [BreakpointList] Simplify/modernize BreakpointList (NFC)

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 8 08:23:19 PST 2019


clayborg added inline comments.


================
Comment at: source/Breakpoint/BreakpointList.cpp:22
+        Target::eBroadcastBitBreakpointChanged,
+        new Breakpoint::BreakpointEventData(event, bp));
+}
----------------
If we don't pass a "BreakpointSP& sp", then use std::move?


================
Comment at: source/Breakpoint/BreakpointList.cpp:123-125
   return std::find_if(m_breakpoints.begin(),
                       m_breakpoints.end(),            // Search full range
                       BreakpointIDMatches(break_id)); // Predicate
----------------
If m_breakpoints is a std::vector, we can keep it sorted and use std::lower_bound for faster lookups


================
Comment at: source/Breakpoint/BreakpointList.cpp:130
 BreakpointList::GetBreakpointIDConstIterator(break_id_t break_id) const {
   return std::find_if(m_breakpoints.begin(),
                       m_breakpoints.end(),            // Search full range
----------------
ditto


================
Comment at: source/Breakpoint/BreakpointList.cpp:188
   size_t curr_i = 0;
-  for (pos = m_breakpoints.begin(), curr_i = 0; pos != end; ++pos, ++curr_i) {
+  for (const auto &bp_sp : m_breakpoints) {
     if (curr_i == i)
----------------
If we use std::vector this will be O(1)


================
Comment at: source/Breakpoint/BreakpointList.cpp:196
 
 const BreakpointSP BreakpointList::GetBreakpointAtIndex(size_t i) const {
   std::lock_guard<std::recursive_mutex> guard(m_mutex);
----------------
vsk wrote:
> Just call the non-const overload and const_cast?
If we use std::vector this will be O(1)


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56425/new/

https://reviews.llvm.org/D56425





More information about the lldb-commits mailing list