diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-07 23:57:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-07 23:57:09 +0000 |
commit | e187d565207682978185624e8fcd8f2c9f31d290 (patch) | |
tree | 6be71844be4bc167e600cefb0ffef2ca3ac29fa2 /include/llvm/Analysis/DataStructure/DSGraphTraits.h | |
parent | bee5ff3ae2625044b7b6361f1b5f19c793768f2a (diff) |
Abstract out the Nodes collection. Instead of providing a getNodes() method,
provide node_begin/end iterators, which are only guaranteed to be
bidirectional, not random access.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11165 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/DataStructure/DSGraphTraits.h')
-rw-r--r-- | include/llvm/Analysis/DataStructure/DSGraphTraits.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/include/llvm/Analysis/DataStructure/DSGraphTraits.h b/include/llvm/Analysis/DataStructure/DSGraphTraits.h index ad2cc6fa8f..72541b8cd1 100644 --- a/include/llvm/Analysis/DataStructure/DSGraphTraits.h +++ b/include/llvm/Analysis/DataStructure/DSGraphTraits.h @@ -115,13 +115,12 @@ template <> struct GraphTraits<DSGraph*> { typedef std::pointer_to_unary_function<DSNode *, DSNode&> DerefFun; // nodes_iterator/begin/end - Allow iteration over all nodes in the graph - typedef mapped_iterator<std::vector<DSNode*>::iterator, - DerefFun> nodes_iterator; + typedef mapped_iterator<DSGraph::node_iterator, DerefFun> nodes_iterator; static nodes_iterator nodes_begin(DSGraph *G) { - return map_iterator(G->getNodes().begin(), DerefFun(dereference)); + return map_iterator(G->node_begin(), DerefFun(dereference)); } static nodes_iterator nodes_end(DSGraph *G) { - return map_iterator(G->getNodes().end(), DerefFun(dereference)); + return map_iterator(G->node_end(), DerefFun(dereference)); } static ChildIteratorType child_begin(NodeType *N) { return N->begin(); } @@ -135,13 +134,12 @@ template <> struct GraphTraits<const DSGraph*> { typedef std::pointer_to_unary_function<const DSNode *,const DSNode&> DerefFun; // nodes_iterator/begin/end - Allow iteration over all nodes in the graph - typedef mapped_iterator<std::vector<DSNode*>::const_iterator, - DerefFun> nodes_iterator; + typedef mapped_iterator<DSGraph::node_iterator, DerefFun> nodes_iterator; static nodes_iterator nodes_begin(const DSGraph *G) { - return map_iterator(G->getNodes().begin(), DerefFun(dereferenceC)); + return map_iterator(G->node_begin(), DerefFun(dereferenceC)); } static nodes_iterator nodes_end(const DSGraph *G) { - return map_iterator(G->getNodes().end(), DerefFun(dereferenceC)); + return map_iterator(G->node_end(), DerefFun(dereferenceC)); } static ChildIteratorType child_begin(const NodeType *N) { return N->begin(); } |