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

Dan Gohman gohman at apple.com
Mon Sep 27 09:44:11 PDT 2010


Author: djg
Date: Mon Sep 27 11:44:11 2010
New Revision: 114837

URL: http://llvm.org/viewvc/llvm-project?rev=114837&view=rev
Log:
Factor out code from the standalone WriteGraph function into a helper
function on GraphWriter.

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=114837&r1=114836&r2=114837&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/GraphWriter.h (original)
+++ llvm/trunk/include/llvm/Support/GraphWriter.h Mon Sep 27 11:44:11 2010
@@ -92,6 +92,24 @@
     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 @@
   // 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;
 }
 





More information about the llvm-commits mailing list