summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CallGraph.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-07-17 07:29:51 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-07-17 07:29:51 +0000
commit3c8fa978adee9387a1e3a1f60e8fe5d6b9ccc14a (patch)
treebdc1ee3e89b5bb4f4716372437fa259560b60651 /clang/lib/Analysis/CallGraph.cpp
parent6a60a66b2be5b527ca46b9c381fd21d0e124be9e (diff)
downloadbcm5719-llvm-3c8fa978adee9387a1e3a1f60e8fe5d6b9ccc14a.tar.gz
bcm5719-llvm-3c8fa978adee9387a1e3a1f60e8fe5d6b9ccc14a.zip
Refactor code into a new CallExpr::getDirectCallee() method. Simplify some
code with the new method. llvm-svn: 76164
Diffstat (limited to 'clang/lib/Analysis/CallGraph.cpp')
-rw-r--r--clang/lib/Analysis/CallGraph.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/clang/lib/Analysis/CallGraph.cpp b/clang/lib/Analysis/CallGraph.cpp
index 16f14d787f4..d49e8ec11be 100644
--- a/clang/lib/Analysis/CallGraph.cpp
+++ b/clang/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);
}
}
OpenPOWER on IntegriCloud