Revert r67844. This fixes the llvm-gcc-4.2 build on Darwin.
[oota-llvm.git] / include / llvm / ADT / ilist_node.h
1 //==-- llvm/ADT/ilist_node.h - Intrusive Linked List Helper ------*- C++ -*-==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the ilist_node class template, which is a convenient
11 // base class for creating classes that can be used with ilists.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_ADT_ILIST_NODE_H
16 #define LLVM_ADT_ILIST_NODE_H
17
18 namespace llvm {
19
20 template<typename NodeTy>
21 struct ilist_nextprev_traits;
22
23 template<typename NodeTy>
24 struct ilist_traits;
25
26 /// ilist_node - Base class that provides next/prev services for nodes
27 /// that use ilist_nextprev_traits or ilist_default_traits.
28 ///
29 template<typename NodeTy>
30 class ilist_node {
31 private:
32   friend struct ilist_nextprev_traits<NodeTy>;
33   friend struct ilist_traits<NodeTy>;
34   NodeTy *Prev, *Next;
35   NodeTy *getPrev() { return Prev; }
36   NodeTy *getNext() { return Next; }
37   const NodeTy *getPrev() const { return Prev; }
38   const NodeTy *getNext() const { return Next; }
39   void setPrev(NodeTy *N) { Prev = N; }
40   void setNext(NodeTy *N) { Next = N; }
41 protected:
42   ilist_node() : Prev(0), Next(0) {}
43 };
44
45 } // End llvm namespace
46
47 #endif