[Lldb-commits] [lldb] [lldb] Store *signed* ranges in lldb_private::Block (PR #120224)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 17 04:57:32 PST 2024
================
@@ -12,6 +12,29 @@
using namespace lldb_private;
+TEST(RangeVector, SignedBaseType) {
+ using RangeVector = RangeVector<int32_t, uint32_t>;
+ using Entry = RangeVector::Entry;
+
+ RangeVector V;
+ V.Append(10, 5);
+ V.Append(-3, 6);
+ V.Append(-10, 3);
+ V.Sort();
+ EXPECT_THAT(V,
+ testing::ElementsAre(Entry(-10, 3), Entry(-3, 6), Entry(10, 5)));
+ Entry e = *V.begin();
+ EXPECT_EQ(e.GetRangeBase(), -10);
+ EXPECT_EQ(e.GetByteSize(), 3u);
+ EXPECT_EQ(e.GetRangeEnd(), -7);
+ EXPECT_TRUE(e.Contains(-10));
+ EXPECT_TRUE(e.Contains(-8));
+ EXPECT_FALSE(e.Contains(-7));
+ EXPECT_TRUE(e.Union(Entry(-8, 2)));
+ EXPECT_EQ(e, Entry(-10, 4));
----------------
DavidSpickett wrote:
How does (-10, 3) become (-10, 4) ? Is this because the Append takes (start, size not including last) and Entry takes (start, size including last)?
https://github.com/llvm/llvm-project/pull/120224
More information about the lldb-commits
mailing list