[Lldb-commits] [PATCH] D67123: [lldb] Early exit in RangeDataVector:FindEntryIndexesThatContain
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 4 04:38:40 PDT 2019
teemperor updated this revision to Diff 218644.
teemperor marked an inline comment as done.
teemperor added a comment.
- remove empty check
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67123/new/
https://reviews.llvm.org/D67123
Files:
lldb/include/lldb/Utility/RangeMap.h
Index: lldb/include/lldb/Utility/RangeMap.h
===================================================================
--- lldb/include/lldb/Utility/RangeMap.h
+++ lldb/include/lldb/Utility/RangeMap.h
@@ -724,12 +724,14 @@
#ifdef ASSERT_RANGEMAP_ARE_SORTED
assert(IsSorted());
#endif
-
- if (!m_entries.empty()) {
- for (const auto &entry : m_entries) {
- if (entry.Contains(addr))
- indexes.push_back(entry.data);
- }
+ // Search the entries until the first entry that has a larger base address
+ // than `addr`. As m_entries is sorted by their base address, all following
+ // entries can't contain `addr` as their base address is already larger.
+ for (const auto &entry : m_entries) {
+ if (entry.Contains(addr))
+ indexes.push_back(entry.data);
+ else if (entry.GetRangeBase() > addr)
+ break;
}
return indexes.size();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67123.218644.patch
Type: text/x-patch
Size: 904 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190904/1c720685/attachment.bin>
More information about the lldb-commits
mailing list