[Lldb-commits] [PATCH] D150219: [lldb][NFCI] Remove n^2 loops and simplify iterator usage

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 9 12:20:55 PDT 2023


mib added inline comments.


================
Comment at: lldb/source/Utility/Broadcaster.cpp:430
 
-  while (true) {
-    auto events_predicate =
-        [&listener](const event_listener_key &input) -> bool {
-      return input.second.get() == listener;
-    };
-    collection::iterator iter, end_iter = m_event_map.end();
-    iter = find_if(m_event_map.begin(), end_iter, events_predicate);
-    if (iter == end_iter)
+  auto events_predicate = [listener](const event_listener_key &input) -> bool {
+    return input.second.get() == listener;
----------------
fdeazeve wrote:
> mib wrote:
> > 
> `listener` is a raw pointer, we shouldn't capture those by reference
I didn't pay attention, I thought it was a local variable. Good point!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150219



More information about the lldb-commits mailing list