From ed4d467c690b549f2cc9721abcc0dbb07291678f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 29 Jan 2005 18:40:19 +0000 Subject: [PATCH] Rename createNode -> createSentinal. Add a new method, destroySentinal, that is used to delete it (instead of requiring use of delete. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19921 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/ilist | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/llvm/ADT/ilist b/include/llvm/ADT/ilist index 0d5e75de75c..f5b9e1d5f85 100644 --- a/include/llvm/ADT/ilist +++ b/include/llvm/ADT/ilist @@ -58,9 +58,10 @@ struct ilist_traits { static void setPrev(NodeTy *N, NodeTy *Prev) { N->setPrev(Prev); } static void setNext(NodeTy *N, NodeTy *Next) { N->setNext(Next); } - static NodeTy *createNode() { return new NodeTy(); } static NodeTy *createNode(const NodeTy &V) { return new NodeTy(V); } + static NodeTy *createSentinal() { return new NodeTy(); } + static void destroySentinal(NodeTy *N) { delete N; } void addNodeToList(NodeTy *NTy) {} void removeNodeFromList(NodeTy *NTy) {} @@ -301,11 +302,11 @@ public: typedef std::reverse_iterator const_reverse_iterator; typedef std::reverse_iterator reverse_iterator; - iplist() : Head(Traits::createNode()), Tail(Head) { + iplist() : Head(Traits::createSentinal()), Tail(Head) { setNext(Head, 0); setPrev(Head, 0); } - ~iplist() { clear(); delete Tail; } + ~iplist() { clear(); Traits::destroySentinal(Tail); } // Iterator creation methods. iterator begin() { return iterator(Head); } -- 2.34.1