diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-07-17 05:49:16 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-07-17 05:49:16 +0000 |
commit | 6c1b35a0ef6131cce7becbdc13972b813462c3d9 (patch) | |
tree | a3590125f0901ab2f708270b9e63f5121690e2ae /clang/lib/Analysis/CallGraph.cpp | |
parent | aaf48343fb5ebc81f1ceb575e443fe191557ba92 (diff) | |
download | bcm5719-llvm-6c1b35a0ef6131cce7becbdc13972b813462c3d9.tar.gz bcm5719-llvm-6c1b35a0ef6131cce7becbdc13972b813462c3d9.zip |
CallGraph:
- add IfStmt visitor.
- print information only when a function has callee. Otherwise its ASTContext
map is NULL.
llvm-svn: 76156
Diffstat (limited to 'clang/lib/Analysis/CallGraph.cpp')
-rw-r--r-- | clang/lib/Analysis/CallGraph.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/clang/lib/Analysis/CallGraph.cpp b/clang/lib/Analysis/CallGraph.cpp index a296f605532..422c5013cc8 100644 --- a/clang/lib/Analysis/CallGraph.cpp +++ b/clang/lib/Analysis/CallGraph.cpp @@ -37,6 +37,10 @@ public: VisitChildren(S); } + void VisitIfStmt(IfStmt *S) { + VisitChildren(S); + } + void VisitCallExpr(CallExpr *CE); void VisitChildren(Stmt *S) { @@ -106,13 +110,15 @@ CallGraphNode *CallGraph::getOrInsertFunction(Entity *F) { void CallGraph::print(llvm::raw_ostream &os) { for (iterator I = begin(), E = end(); I != E; ++I) { - ASTContext &Ctx = *CallerCtx[I->second]; - os << "function: " << I->first->getName(Ctx) << " calls:\n"; - for (CallGraphNode::iterator CI = I->second->begin(), CE = I->second->end(); - CI != CE; ++CI) { - os << " " << CI->second->getName(Ctx); + if (I->second->hasCallee()) { + ASTContext &Ctx = *CallerCtx[I->second]; + os << "function: " << I->first->getName(Ctx) << " calls:\n"; + for (CallGraphNode::iterator CI = I->second->begin(), + CE = I->second->end(); CI != CE; ++CI) { + os << " " << CI->second->getName(Ctx); + } + os << '\n'; } - os << '\n'; } } |