summaryrefslogtreecommitdiffstats
path: root/include/llvm/Support/GraphWriter.h
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-09-27 16:44:11 +0000
committerDan Gohman <gohman@apple.com>2010-09-27 16:44:11 +0000
commitf7e2ca9e161140f658a2ae65ad67e508b703ac8c (patch)
tree73dd25b2920c034b7477da9c25a8fe8c12536efb /include/llvm/Support/GraphWriter.h
parentc576d3d7fe1100021d892e488ba6b23bdbea2309 (diff)
downloadexternal_llvm-f7e2ca9e161140f658a2ae65ad67e508b703ac8c.zip
external_llvm-f7e2ca9e161140f658a2ae65ad67e508b703ac8c.tar.gz
external_llvm-f7e2ca9e161140f658a2ae65ad67e508b703ac8c.tar.bz2
Factor out code from the standalone WriteGraph function into a helper
function on GraphWriter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114837 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/GraphWriter.h')
-rw-r--r--include/llvm/Support/GraphWriter.h30
1 files changed, 20 insertions, 10 deletions
diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h
index 5e91d25..adfe5ec 100644
--- a/include/llvm/Support/GraphWriter.h
+++ b/include/llvm/Support/GraphWriter.h
@@ -92,6 +92,24 @@ public:
DTraits = DOTTraits(SN);
}
+ void writeGraph(bool ShortNames = false,
+ const std::string &Title = "") {
+ // Start the graph emission process...
+ GraphWriter<GraphType> W(O, G, ShortNames);
+
+ // Output the header for the graph...
+ W.writeHeader(Title);
+
+ // Emit all of the nodes in the graph...
+ W.writeNodes();
+
+ // Output any customizations on the graph
+ DOTGraphTraits<GraphType>::addCustomGraphFeatures(G, W);
+
+ // Output the end of the graph
+ W.writeFooter();
+ }
+
void writeHeader(const std::string &Title) {
std::string GraphName = DTraits.getGraphName(G);
@@ -286,17 +304,9 @@ raw_ostream &WriteGraph(raw_ostream &O, const GraphType &G,
// Start the graph emission process...
GraphWriter<GraphType> W(O, G, ShortNames);
- // Output the header for the graph...
- W.writeHeader(Title);
-
- // Emit all of the nodes in the graph...
- W.writeNodes();
-
- // Output any customizations on the graph
- DOTGraphTraits<GraphType>::addCustomGraphFeatures(G, W);
+ // Emit the graph.
+ W.writeGraph(ShortNames, Title);
- // Output the end of the graph
- W.writeFooter();
return O;
}