jingham accepted this revision.
jingham added a comment.

You are inconsistent in a couple of places about whether you re-look up 
m_event_map.end or use the version you captured in a variable, which is a 
little confusing.  Other than that this looks equivalent



================
Comment at: lldb/source/Utility/Broadcaster.cpp:381
+  for (auto begin = m_event_map.begin(), end = m_event_map.end();;) {
+    auto iter = find_if(begin, end, listener_matches_and_shared_bits);
+    if (iter == m_event_map.end())
----------------
Why do you re-look-up `m_event_map.end()` instead of using the `end` variable 
you defined in the `for` initializer?

std::map::erase says it only invalidates iterators to the erased element, so 
you should be fine to use `end` here (and since you do exactly that in the 
previous line) it should be good here too.


================
Comment at: lldb/source/Utility/Broadcaster.cpp:436
+    iter = find_if(iter, end, events_predicate);
+    if (iter == m_event_map.end())
       break;
----------------
fdeazeve wrote:
> this should be `== end`
Again here, you don't trust the "end" variable, but then in the next function 
you do reuse end_iter.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150219

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits]... Felipe de Azevedo Piovezan via Phabricator via lldb-commits
    • [Lldb-com... Felipe de Azevedo Piovezan via Phabricator via lldb-commits
    • [Lldb-com... Felipe de Azevedo Piovezan via Phabricator via lldb-commits
    • [Lldb-com... Felipe de Azevedo Piovezan via Phabricator via lldb-commits
    • [Lldb-com... Med Ismail Bennani via Phabricator via lldb-commits
    • [Lldb-com... Felipe de Azevedo Piovezan via Phabricator via lldb-commits
    • [Lldb-com... Med Ismail Bennani via Phabricator via lldb-commits
    • [Lldb-com... Med Ismail Bennani via Phabricator via lldb-commits
    • [Lldb-com... Alex Langford via Phabricator via lldb-commits
    • [Lldb-com... Jim Ingham via Phabricator via lldb-commits
    • [Lldb-com... Felipe de Azevedo Piovezan via Phabricator via lldb-commits
    • [Lldb-com... Felipe de Azevedo Piovezan via Phabricator via lldb-commits
    • [Lldb-com... Felipe de Azevedo Piovezan via Phabricator via lldb-commits

Reply via email to