aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-08 23:33:46 +0000
committerDan Gohman <gohman@apple.com>2008-07-08 23:33:46 +0000
commitafbd0737e7593f1b79ed5060e506749558e82ab9 (patch)
tree4b1b5fd9d08f8dde4c3e72b403e0f388ef22bff7
parent491fccc4b4df32a14f33fa87cb3799cf45bb5fdd (diff)
The graph name really does matter for configurations that use gv.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53259 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Support/GraphWriter.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h
index 833f4a8e08..14a70cb189 100644
--- a/include/llvm/Support/GraphWriter.h
+++ b/include/llvm/Support/GraphWriter.h
@@ -82,15 +82,18 @@ public:
GraphWriter(std::ostream &o, const GraphType &g) : O(o), G(g) {}
void writeHeader(const std::string &Name) {
- if (Name.empty())
- O << "digraph foo {\n"; // Graph name doesn't matter
- else
+ std::string GraphName = DOTTraits::getGraphName(G);
+
+ if (!Name.empty())
O << "digraph " << Name << " {\n";
+ else if (!GraphName.empty())
+ O << "digraph " << GraphName << " {\n";
+ else
+ O << "digraph unnamed {\n";
if (DOTTraits::renderGraphFromBottomUp())
O << "\trankdir=\"BT\";\n";
- std::string GraphName = DOTTraits::getGraphName(G);
if (!GraphName.empty())
O << "\tlabel=\"" << DOT::EscapeString(GraphName) << "\";\n";
O << DOTTraits::getGraphProperties(G);