summaryrefslogtreecommitdiff
path: root/include/llvm/Support/GraphWriter.h
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-21 19:57:57 +0000
committerDan Gohman <gohman@apple.com>2008-07-21 19:57:57 +0000
commit2d3ff5a7aee24024765629d17ebff351ea11c9bb (patch)
tree4ea55c3cc9f778d5adc959137284f11ae1f50c97 /include/llvm/Support/GraphWriter.h
parent80f3d46968c56bb93597248d7e0157e746c5ce1b (diff)
downloadllvm-2d3ff5a7aee24024765629d17ebff351ea11c9bb.tar.gz
llvm-2d3ff5a7aee24024765629d17ebff351ea11c9bb.tar.bz2
llvm-2d3ff5a7aee24024765629d17ebff351ea11c9bb.tar.xz
Make the GraphWriter be more consistent about the string
used for the graph "title" and the graph "label", as there are differences in interpretation of these strings between viewers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53871 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/GraphWriter.h')
-rw-r--r--include/llvm/Support/GraphWriter.h27
1 files changed, 8 insertions, 19 deletions
diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h
index dab09e57c6..afb2f545bb 100644
--- a/include/llvm/Support/GraphWriter.h
+++ b/include/llvm/Support/GraphWriter.h
@@ -85,7 +85,7 @@ public:
std::string GraphName = DOTTraits::getGraphName(G);
if (!Name.empty())
- O << "digraph " << Name << " {\n";
+ O << "digraph \"" << DOT::EscapeString(Name) << "\" {\n";
else if (!GraphName.empty())
O << "digraph \"" << DOT::EscapeString(GraphName) << "\" {\n";
else
@@ -94,7 +94,9 @@ public:
if (DOTTraits::renderGraphFromBottomUp())
O << "\trankdir=\"BT\";\n";
- if (!GraphName.empty())
+ if (!Name.empty())
+ O << "\tlabel=\"" << DOT::EscapeString(Name) << "\";\n";
+ else if (!GraphName.empty())
O << "\tlabel=\"" << DOT::EscapeString(GraphName) << "\";\n";
O << DOTTraits::getGraphProperties(G);
O << "\n";
@@ -234,12 +236,13 @@ public:
template<typename GraphType>
std::ostream &WriteGraph(std::ostream &O, const GraphType &G,
- const std::string &Name = "") {
+ const std::string &Name = "",
+ const std::string &Title = "") {
// Start the graph emission process...
GraphWriter<GraphType> W(O, G);
// Output the header for the graph...
- W.writeHeader(Name);
+ W.writeHeader(Title);
// Emit all of the nodes in the graph...
W.writeNodes();
@@ -273,24 +276,10 @@ sys::Path WriteGraph(const GraphType &G,
std::ofstream O(Filename.c_str());
if (O.good()) {
- // Start the graph emission process...
- GraphWriter<GraphType> W(O, G);
-
- // 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();
+ WriteGraph(O, G, Name, Title);
cerr << " done. \n";
O.close();
-
} else {
cerr << "error opening file for writing!\n";
Filename.clear();