summaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-10-10 22:31:31 +0000
committerChris Lattner <sabre@nondot.org>2002-10-10 22:31:31 +0000
commitf77b57097d00b301c164e10a034860fdbbcbe932 (patch)
treedb736c5cd1f33735ebd479869998ec8fb189ab8c /include/llvm
parentab363148fb3abd978d7939d58e322e1777aea6c3 (diff)
downloadexternal_llvm-f77b57097d00b301c164e10a034860fdbbcbe932.zip
external_llvm-f77b57097d00b301c164e10a034860fdbbcbe932.tar.gz
external_llvm-f77b57097d00b301c164e10a034860fdbbcbe932.tar.bz2
Expose API to graph library to allow iteration over all nodes, even unreachable ones
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4111 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Support/CFG.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/llvm/Support/CFG.h b/include/llvm/Support/CFG.h
index 8b68627..48918e0 100644
--- a/include/llvm/Support/CFG.h
+++ b/include/llvm/Support/CFG.h
@@ -10,7 +10,6 @@
#include "Support/GraphTraits.h"
#include "llvm/Function.h"
-#include "llvm/BasicBlock.h"
#include "llvm/InstrTypes.h"
#include "Support/iterator"
@@ -220,10 +219,20 @@ template <> struct GraphTraits<Inverse<const BasicBlock*> > {
//
template <> struct GraphTraits<Function*> : public GraphTraits<BasicBlock*> {
static NodeType *getEntryNode(Function *F) { return &F->getEntryNode(); }
+
+ // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
+ typedef Function::iterator nodes_iterator;
+ static nodes_iterator nodes_begin(Function *F) { return F->begin(); }
+ static nodes_iterator nodes_end (Function *F) { return F->end(); }
};
template <> struct GraphTraits<const Function*> :
public GraphTraits<const BasicBlock*> {
static NodeType *getEntryNode(const Function *F) { return &F->getEntryNode();}
+
+ // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
+ typedef Function::const_iterator nodes_iterator;
+ static nodes_iterator nodes_begin(const Function *F) { return F->begin(); }
+ static nodes_iterator nodes_end (const Function *F) { return F->end(); }
};