[llvm-commits] [llvm] r53259 - /llvm/trunk/include/llvm/Support/GraphWriter.h

Dan Gohman gohman at apple.com
Tue Jul 8 16:33:46 PDT 2008


Author: djg
Date: Tue Jul  8 18:33:46 2008
New Revision: 53259

URL: http://llvm.org/viewvc/llvm-project?rev=53259&view=rev
Log:
The graph name really does matter for configurations that use gv.

Modified:
    llvm/trunk/include/llvm/Support/GraphWriter.h

Modified: llvm/trunk/include/llvm/Support/GraphWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=53259&r1=53258&r2=53259&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/GraphWriter.h (original)
+++ llvm/trunk/include/llvm/Support/GraphWriter.h Tue Jul  8 18:33:46 2008
@@ -82,15 +82,18 @@
   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);





More information about the llvm-commits mailing list