diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-09-01 22:55:40 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-09-01 22:55:40 +0000 |
commit | 551ccae044b0ff658fe629dd67edd5ffe75d10e8 (patch) | |
tree | d7fa643a1f1f12dbc4ee049bcc7a032a49b17d51 /include/Support/Tree.h | |
parent | ed543731fb385b55750d0c514d130a810339d739 (diff) | |
download | external_llvm-551ccae044b0ff658fe629dd67edd5ffe75d10e8.zip external_llvm-551ccae044b0ff658fe629dd67edd5ffe75d10e8.tar.gz external_llvm-551ccae044b0ff658fe629dd67edd5ffe75d10e8.tar.bz2 |
Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/Support/Tree.h')
-rw-r--r-- | include/Support/Tree.h | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/include/Support/Tree.h b/include/Support/Tree.h deleted file mode 100644 index 48ecf5b..0000000 --- a/include/Support/Tree.h +++ /dev/null @@ -1,62 +0,0 @@ -//===- Support/Tree.h - Generic n-way tree structure ------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and 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 - -#include <vector> - -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... - -protected: - void setChildren(const std::vector<ConcreteTreeNode*> &children) { - Children = children; - } -public: - inline Tree(ConcreteTreeNode *parent) : Parent(parent) {} - inline Tree(const std::vector<ConcreteTreeNode*> &children, - ConcreteTreeNode *par) : Children(children), Parent(par) {} - - inline Tree(const std::vector<ConcreteTreeNode*> &children, - ConcreteTreeNode *par, const Payload &data) - : Children(children), Parent(par), Data(data) {} - - // Tree dtor - Free all children - inline ~Tree() { - for (unsigned i = Children.size(); i > 0; --i) - delete Children[i-1]; - } - - // Tree manipulation/walking routines... - inline ConcreteTreeNode *getParent() const { return Parent; } - inline unsigned getNumChildren() const { return Children.size(); } - inline ConcreteTreeNode *getChild(unsigned i) const { - assert(i < Children.size() && "Tree::getChild with index out of range!"); - return Children[i]; - } - - // Payload access... - inline Payload &getTreeData() { return Data; } - inline const Payload &getTreeData() const { return Data; } -}; - -} // End llvm namespace - -#endif |