diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-07-17 07:29:51 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-07-17 07:29:51 +0000 |
commit | a00425414e8c209cabc25d1826b200aeb94259af (patch) | |
tree | 9f57b8d4eea42fdb6ddcfd0d9fa0f3e7d8538614 /lib/Analysis/CallGraph.cpp | |
parent | 6fc45052986633e0ba0cc375c9a9eba909888412 (diff) |
Refactor code into a new CallExpr::getDirectCallee() method. Simplify some
code with the new method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76164 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CallGraph.cpp')
-rw-r--r-- | lib/Analysis/CallGraph.cpp | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/Analysis/CallGraph.cpp b/lib/Analysis/CallGraph.cpp index 16f14d787f..d49e8ec11b 100644 --- a/lib/Analysis/CallGraph.cpp +++ b/lib/Analysis/CallGraph.cpp @@ -66,21 +66,10 @@ public: } void CGBuilder::VisitCallExpr(CallExpr *CE) { - Expr *Callee = CE->getCallee(); - - if (CastExpr *CE = dyn_cast<CastExpr>(Callee)) - Callee = CE->getSubExpr(); - - if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Callee)) { - Decl *D = DRE->getDecl(); - if (FunctionDecl *CalleeDecl = dyn_cast<FunctionDecl>(D)) { - - Entity *Ent = Entity::get(CalleeDecl, G.getProgram()); - - CallGraphNode *CalleeNode = G.getOrInsertFunction(Ent); - - CallerNode->addCallee(ASTLocation(FD, CE), CalleeNode); - } + if (FunctionDecl *CalleeDecl = CE->getDirectCallee()) { + Entity *Ent = Entity::get(CalleeDecl, G.getProgram()); + CallGraphNode *CalleeNode = G.getOrInsertFunction(Ent); + CallerNode->addCallee(ASTLocation(FD, CE), CalleeNode); } } |