mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-13 21:05:16 +00:00
Support backwards iteration starting from end().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119871 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a197cba66d
commit
db52566d68
@ -1235,7 +1235,7 @@ public:
|
|||||||
if (!branched()) {
|
if (!branched()) {
|
||||||
assert(rootOffset && "Cannot decrement begin()");
|
assert(rootOffset && "Cannot decrement begin()");
|
||||||
--rootOffset;
|
--rootOffset;
|
||||||
} else if (treeLeafOffset())
|
} else if (valid() && treeLeafOffset())
|
||||||
--treeLeafOffset();
|
--treeLeafOffset();
|
||||||
else
|
else
|
||||||
treeDecrement();
|
treeDecrement();
|
||||||
|
@ -352,6 +352,16 @@ TEST(IntervalMapTest, Branched) {
|
|||||||
EXPECT_FALSE(I.valid());
|
EXPECT_FALSE(I.valid());
|
||||||
EXPECT_TRUE(I == map.end());
|
EXPECT_TRUE(I == map.end());
|
||||||
|
|
||||||
|
// Backwards iteration.
|
||||||
|
for (unsigned i = 99; i; --i) {
|
||||||
|
--I;
|
||||||
|
ASSERT_TRUE(I.valid());
|
||||||
|
EXPECT_EQ(10*i, I.start());
|
||||||
|
EXPECT_EQ(10*i+5, I.stop());
|
||||||
|
EXPECT_EQ(i, *I);
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(I == map.begin());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user