[Lldb-commits] [PATCH] D67123: [lldb] Early exit in RangeDataVector:FindEntryIndexesThatContain

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 4 01:00:03 PDT 2019


labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: lldb/include/lldb/Utility/RangeMap.h:728-729
 
-    if (!m_entries.empty()) {
-      for (const auto &entry : m_entries) {
-        if (entry.Contains(addr))
-          indexes.push_back(entry.data);
-      }
+    if (m_entries.empty())
+      return indexes.size();
+
----------------
This pattern seems to be common in lldb, but I really don't understand the reason behind it -- it just checks the condition that would be checked by the for loop anyway. I've personally just started removing checks like these whenever I touch some code which uses them...


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

https://reviews.llvm.org/D67123





More information about the lldb-commits mailing list