[llvm-commits] [llvm] r120239 - in /llvm/trunk: include/llvm/ADT/IntervalMap.h unittests/ADT/IntervalMapTest.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Sat Nov 27 23:21:49 PST 2010
Author: stoklund
Date: Sun Nov 28 01:21:48 2010
New Revision: 120239
URL: http://llvm.org/viewvc/llvm-project?rev=120239&view=rev
Log:
Add default constructors for iterators.
These iterators don't point anywhere, and they can't be compared to anything.
They are only good for assigning to.
Modified:
llvm/trunk/include/llvm/ADT/IntervalMap.h
llvm/trunk/unittests/ADT/IntervalMapTest.cpp
Modified: llvm/trunk/include/llvm/ADT/IntervalMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/IntervalMap.h?rev=120239&r1=120238&r2=120239&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/IntervalMap.h (original)
+++ llvm/trunk/include/llvm/ADT/IntervalMap.h Sun Nov 28 01:21:48 2010
@@ -1397,6 +1397,9 @@
void treeAdvanceTo(KeyT x);
public:
+ /// const_iterator - Create an iterator that isn't pointing anywhere.
+ const_iterator() : map(0) {}
+
/// valid - Return true if the current position is valid, false for end().
bool valid() const { return path.valid(); }
@@ -1583,6 +1586,9 @@
void eraseNode(unsigned Level);
void treeErase(bool UpdateRoot = true);
public:
+ /// iterator - Create null iterator.
+ iterator() {}
+
/// insert - Insert mapping [a;b] -> y before the current position.
void insert(KeyT a, KeyT b, ValT y);
Modified: llvm/trunk/unittests/ADT/IntervalMapTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/IntervalMapTest.cpp?rev=120239&r1=120238&r2=120239&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/IntervalMapTest.cpp (original)
+++ llvm/trunk/unittests/ADT/IntervalMapTest.cpp Sun Nov 28 01:21:48 2010
@@ -41,6 +41,14 @@
UUMap::iterator I = map.begin();
EXPECT_FALSE(I.valid());
EXPECT_TRUE(I == map.end());
+
+ // Default constructor and cross-constness compares.
+ UUMap::const_iterator CI;
+ CI = map.begin();
+ EXPECT_TRUE(CI == I);
+ UUMap::iterator I2;
+ I2 = map.end();
+ EXPECT_TRUE(I2 == CI);
}
// Single entry map tests
More information about the llvm-commits
mailing list