diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-05-13 18:35:02 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-13 18:35:02 +0000 |
commit | f1fd2288f36b58b8979761ba09e2a398c6afd110 (patch) | |
tree | 7c409d511f86adacf959a235b949f0ee3bd15a16 | |
parent | 18e05b4692068b2cc1dfbc3aeb682ac2ec63d11b (diff) | |
download | external_llvm-f1fd2288f36b58b8979761ba09e2a398c6afd110.zip external_llvm-f1fd2288f36b58b8979761ba09e2a398c6afd110.tar.gz external_llvm-f1fd2288f36b58b8979761ba09e2a398c6afd110.tar.bz2 |
Fix const ilist_node::get{Prev,Next}Node() to actually compile. Picky, picky.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103723 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/ADT/ilist_node.h | 4 | ||||
-rw-r--r-- | unittests/ADT/ilistTest.cpp | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/include/llvm/ADT/ilist_node.h b/include/llvm/ADT/ilist_node.h index 3de4f15..f008003 100644 --- a/include/llvm/ADT/ilist_node.h +++ b/include/llvm/ADT/ilist_node.h @@ -67,7 +67,7 @@ public: /// \brief Get the previous node, or 0 for the list head. const NodeTy *getPrevNode() const { - NodeTy *Prev = this->getPrev(); + const NodeTy *Prev = this->getPrev(); // Check for sentinel. if (!Prev->getNext()) @@ -89,7 +89,7 @@ public: /// \brief Get the next node, or 0 for the list tail. const NodeTy *getNextNode() const { - NodeTy *Next = getNext(); + const NodeTy *Next = getNext(); // Check for sentinel. if (!Next->getNext()) diff --git a/unittests/ADT/ilistTest.cpp b/unittests/ADT/ilistTest.cpp index 3bf04dc..09a699a 100644 --- a/unittests/ADT/ilistTest.cpp +++ b/unittests/ADT/ilistTest.cpp @@ -34,6 +34,11 @@ TEST(ilistTest, Basic) { EXPECT_EQ(2, List.back().Value); EXPECT_EQ(2, List.front().getNextNode()->Value); EXPECT_EQ(1, List.back().getPrevNode()->Value); + + const ilist<Node> &ConstList = List; + EXPECT_EQ(2, ConstList.back().Value); + EXPECT_EQ(2, ConstList.front().getNextNode()->Value); + EXPECT_EQ(1, ConstList.back().getPrevNode()->Value); } } |