mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-02 08:26:29 +00:00
Small PostDominatorTree improvements
* Do not SEGFAULT if tree entryNode() is NULL * Print function names in dotty printer llvm-svn: 90130
This commit is contained in:
parent
6cf9fe9d69
commit
38b3077d08
@ -81,7 +81,10 @@ template <> struct GraphTraits<PostDominatorTree*>
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -85,9 +85,11 @@ struct GenericGraphViewer : public FunctionPass {
|
||||
|
||||
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 @@ struct GenericGraphPrinter : public FunctionPass {
|
||||
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";
|
||||
|
Loading…
Reference in New Issue
Block a user