[llvm-commits] CVS: llvm/include/llvm/Support/CFG.h
Chris Lattner
lattner at cs.uiuc.edu
Thu Oct 10 17:32:04 PDT 2002
Changes in directory llvm/include/llvm/Support:
CFG.h updated: 1.7 -> 1.8
---
Log message:
Expose API to graph library to allow iteration over all nodes, even unreachable ones
---
Diffs of the changes:
Index: llvm/include/llvm/Support/CFG.h
diff -u llvm/include/llvm/Support/CFG.h:1.7 llvm/include/llvm/Support/CFG.h:1.8
--- llvm/include/llvm/Support/CFG.h:1.7 Mon Oct 7 12:13:22 2002
+++ llvm/include/llvm/Support/CFG.h Thu Oct 10 17:31:31 2002
@@ -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<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(); }
};
More information about the llvm-commits
mailing list