fix a bug in post-order iterators with external storage, patch by
[oota-llvm.git] / include / llvm / ADT / Tree.h
index 7a3e9c43505f9e8d13acf7e738a2ee92fff186eb..78f5b4fab97f74fd52ff31e00b3913664c99669d 100644 (file)
@@ -1,21 +1,29 @@
-//===- Support/Tree.h - Generic n-way tree structure -------------*- C++ -*--=//
+//===- llvm/ADT/Tree.h - Generic n-way tree structure -----------*- C++ -*-===//
 //
-// This class defines a generic N way tree node structure.  The tree structure
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This class defines a generic N-way tree node structure.  The tree structure
 // is immutable after creation, but the payload contained within it is not.
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef SUPPORT_TREE_H
-#define SUPPORT_TREE_H
+#ifndef LLVM_ADT_TREE_H
+#define LLVM_ADT_TREE_H
 
 #include <vector>
-#include <assert.h>
+
+namespace llvm {
 
 template<class ConcreteTreeNode, class Payload>
 class Tree {
-  std::vector<ConcreteTreeNode*> Children;        // This nodes children, if any
-  ConcreteTreeNode              *Parent;          // Parent of this node...
-  Payload                        Data;            // Data held in this node...
+  std::vector<ConcreteTreeNode*> Children;      // This node's children, if any.
+  ConcreteTreeNode              *Parent;        // Parent of this node.
+  Payload                        Data;          // Data held in this node.
 
 protected:
   void setChildren(const std::vector<ConcreteTreeNode*> &children) {
@@ -27,8 +35,8 @@ public:
               ConcreteTreeNode *par) : Children(children), Parent(par) {}
 
   inline Tree(const std::vector<ConcreteTreeNode*> &children,
-              ConcreteTreeNode *par, const Payload &data) 
-    : Children(children), Parent(parent), Data(data) {}
+              ConcreteTreeNode *par, const Payload &data)
+    : Children(children), Parent(par), Data(data) {}
 
   // Tree dtor - Free all children
   inline ~Tree() {
@@ -49,5 +57,6 @@ public:
   inline const Payload &getTreeData() const { return Data; }
 };
 
+} // End llvm namespace
 
 #endif