From f6516da9b3b39ccdf0efe8f999ecbae31d2497be Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 10 Oct 2002 22:29:51 +0000 Subject: [PATCH] * Don't only print out reachable nodes in the graph. * use new api to get all nodes in the graph * Allow custom graph traits git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4109 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/Support/GraphWriter.h | 14 +++++++------- include/llvm/Support/GraphWriter.h | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/Support/GraphWriter.h b/include/Support/GraphWriter.h index 7742aff40e8..fadff105362 100644 --- a/include/Support/GraphWriter.h +++ b/include/Support/GraphWriter.h @@ -17,7 +17,7 @@ #define SUPPORT_GRAPHWRITER_H #include "Support/DOTGraphTraits.h" -#include "Support/DepthFirstIterator.h" +#include "Support/GraphTraits.h" #include namespace DOT { // Private functions... @@ -53,19 +53,19 @@ std::ostream &WriteGraph(std::ostream &O, const GraphType &G) { typedef DOTGraphTraits DOTTraits; typedef GraphTraits GTraits; typedef typename GTraits::NodeType NodeType; + typedef typename GTraits::nodes_iterator node_iterator; - O << "digraph foo {\n" // Graph name doesn't matter - << "\tsize=\"7.5,10\";\n"; // Size to fit on a page - + O << "digraph foo {\n"; // Graph name doesn't matter std::string GraphName = DOTTraits::getGraphName(G); if (!GraphName.empty()) O << "\tlabel=\"" << DOT::EscapeString(GraphName) << "\";\n"; + O << DOTTraits::getGraphProperties(G); O << "\n"; // Loop over the graph in DFO, printing it out... - NodeType *Root = GTraits::getEntryNode(G); - for (df_iterator I = df_begin(G), E = df_end(G); I != E; ++I) { - NodeType *Node = *I; + for (node_iterator I = GTraits::nodes_begin(G), E = GTraits::nodes_end(G); + I != E; ++I) { + NodeType *Node = &*I; std::string NodeAttributes = DOTTraits::getNodeAttributes(Node); diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h index 7742aff40e8..fadff105362 100644 --- a/include/llvm/Support/GraphWriter.h +++ b/include/llvm/Support/GraphWriter.h @@ -17,7 +17,7 @@ #define SUPPORT_GRAPHWRITER_H #include "Support/DOTGraphTraits.h" -#include "Support/DepthFirstIterator.h" +#include "Support/GraphTraits.h" #include namespace DOT { // Private functions... @@ -53,19 +53,19 @@ std::ostream &WriteGraph(std::ostream &O, const GraphType &G) { typedef DOTGraphTraits DOTTraits; typedef GraphTraits GTraits; typedef typename GTraits::NodeType NodeType; + typedef typename GTraits::nodes_iterator node_iterator; - O << "digraph foo {\n" // Graph name doesn't matter - << "\tsize=\"7.5,10\";\n"; // Size to fit on a page - + O << "digraph foo {\n"; // Graph name doesn't matter std::string GraphName = DOTTraits::getGraphName(G); if (!GraphName.empty()) O << "\tlabel=\"" << DOT::EscapeString(GraphName) << "\";\n"; + O << DOTTraits::getGraphProperties(G); O << "\n"; // Loop over the graph in DFO, printing it out... - NodeType *Root = GTraits::getEntryNode(G); - for (df_iterator I = df_begin(G), E = df_end(G); I != E; ++I) { - NodeType *Node = *I; + for (node_iterator I = GTraits::nodes_begin(G), E = GTraits::nodes_end(G); + I != E; ++I) { + NodeType *Node = &*I; std::string NodeAttributes = DOTTraits::getNodeAttributes(Node);