[llvm-commits] [llvm] r103723 - in /llvm/trunk: include/llvm/ADT/ilist_node.h unittests/ADT/ilistTest.cpp
Daniel Dunbar
daniel at zuster.org
Thu May 13 11:35:03 PDT 2010
Author: ddunbar
Date: Thu May 13 13:35:02 2010
New Revision: 103723
URL: http://llvm.org/viewvc/llvm-project?rev=103723&view=rev
Log:
Fix const ilist_node::get{Prev,Next}Node() to actually compile. Picky, picky.
Modified:
llvm/trunk/include/llvm/ADT/ilist_node.h
llvm/trunk/unittests/ADT/ilistTest.cpp
Modified: llvm/trunk/include/llvm/ADT/ilist_node.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist_node.h?rev=103723&r1=103722&r2=103723&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ilist_node.h (original)
+++ llvm/trunk/include/llvm/ADT/ilist_node.h Thu May 13 13:35:02 2010
@@ -67,7 +67,7 @@
/// \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 @@
/// \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())
Modified: llvm/trunk/unittests/ADT/ilistTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/ilistTest.cpp?rev=103723&r1=103722&r2=103723&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/ilistTest.cpp (original)
+++ llvm/trunk/unittests/ADT/ilistTest.cpp Thu May 13 13:35:02 2010
@@ -34,6 +34,11 @@
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);
}
}
More information about the llvm-commits
mailing list