[llvm-commits] [llvm] r90130 - in /llvm/trunk: include/llvm/Analysis/PostDominators.h lib/Analysis/DomPrinter.cpp

Tobias Grosser grosser at fim.uni-passau.de
Mon Nov 30 04:06:38 PST 2009


Author: grosser
Date: Mon Nov 30 06:06:37 2009
New Revision: 90130

URL: http://llvm.org/viewvc/llvm-project?rev=90130&view=rev
Log:
Small PostDominatorTree improvements

 * Do not SEGFAULT if tree entryNode() is NULL
 * Print function names in dotty printer

Modified:
    llvm/trunk/include/llvm/Analysis/PostDominators.h
    llvm/trunk/lib/Analysis/DomPrinter.cpp

Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=90130&r1=90129&r2=90130&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/PostDominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/PostDominators.h Mon Nov 30 06:06:37 2009
@@ -81,7 +81,10 @@
   }
 
   static nodes_iterator nodes_begin(PostDominatorTree *N) {
-    return df_begin(getEntryNode(N));
+    if (getEntryNode(N))
+      return df_begin(getEntryNode(N));
+    else
+      return df_end(getEntryNode(N));
   }
 
   static nodes_iterator nodes_end(PostDominatorTree *N) {

Modified: llvm/trunk/lib/Analysis/DomPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DomPrinter.cpp?rev=90130&r1=90129&r2=90130&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/DomPrinter.cpp (original)
+++ llvm/trunk/lib/Analysis/DomPrinter.cpp Mon Nov 30 06:06:37 2009
@@ -85,9 +85,11 @@
 
   virtual bool runOnFunction(Function &F) {
     Analysis *Graph;
-
+    std::string Title, GraphName;
     Graph = &getAnalysis<Analysis>();
-    ViewGraph(Graph, Name, OnlyBBS);
+    GraphName = DOTGraphTraits<Analysis*>::getGraphName(Graph);
+    Title = GraphName + " for '" + F.getNameStr() + "' function";
+    ViewGraph(Graph, Name, OnlyBBS, Title);
 
     return false;
   }
@@ -163,8 +165,12 @@
     raw_fd_ostream File(Filename.c_str(), ErrorInfo);
     Graph = &getAnalysis<Analysis>();
 
+    std::string Title, GraphName;
+    GraphName = DOTGraphTraits<Analysis*>::getGraphName(Graph);
+    Title = GraphName + " for '" + F.getNameStr() + "' function";
+
     if (ErrorInfo.empty())
-      WriteGraph(File, Graph, OnlyBBS);
+      WriteGraph(File, Graph, OnlyBBS, Name, Title);
     else
       errs() << "  error opening file for writing!";
     errs() << "\n";





More information about the llvm-commits mailing list