mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:50:30 +00:00
Support backwards iteration starting from end().
llvm-svn: 119871
This commit is contained in:
parent
0840b75ab3
commit
328eb0d328
@ -1235,7 +1235,7 @@ public:
|
||||
if (!branched()) {
|
||||
assert(rootOffset && "Cannot decrement begin()");
|
||||
--rootOffset;
|
||||
} else if (treeLeafOffset())
|
||||
} else if (valid() && treeLeafOffset())
|
||||
--treeLeafOffset();
|
||||
else
|
||||
treeDecrement();
|
||||
|
@ -352,6 +352,16 @@ TEST(IntervalMapTest, Branched) {
|
||||
EXPECT_FALSE(I.valid());
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user