}
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) {
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;
}
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";