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 | 2842f256250589ea797816e5f65a4ddc00ef97e7 (patch) | |
| tree | 75a3c55618eebc31d4e13aea5acd8bf31d574675 /llvm | |
| parent | f8bfb45e9b1b5633d403a6ee6292cc12c8f65cd9 (diff) | |
| download | bcm5719-llvm-2842f256250589ea797816e5f65a4ddc00ef97e7.tar.gz bcm5719-llvm-2842f256250589ea797816e5f65a4ddc00ef97e7.zip | |
Fix const ilist_node::get{Prev,Next}Node() to actually compile. Picky, picky.
llvm-svn: 103723
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/ADT/ilist_node.h | 4 | ||||
| -rw-r--r-- | llvm/unittests/ADT/ilistTest.cpp | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/llvm/include/llvm/ADT/ilist_node.h b/llvm/include/llvm/ADT/ilist_node.h index 3de4f156d20..f0080035cb8 100644 --- a/llvm/include/llvm/ADT/ilist_node.h +++ b/llvm/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/llvm/unittests/ADT/ilistTest.cpp b/llvm/unittests/ADT/ilistTest.cpp index 3bf04dccc2c..09a699a9624 100644 --- a/llvm/unittests/ADT/ilistTest.cpp +++ b/llvm/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); } } |

