summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-09-10 20:55:30 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-09-10 20:55:30 +0000
commit2b1832e445a3f2796e231337d3ad1c31ffd1ec1d (patch)
tree717c35ac0a8dcadafa1e548fc55c70a738638a44 /clang/lib/AST/Expr.cpp
parent7ec4c282f26d6786facc814600ef82dc153617a0 (diff)
downloadbcm5719-llvm-2b1832e445a3f2796e231337d3ad1c31ffd1ec1d.tar.gz
bcm5719-llvm-2b1832e445a3f2796e231337d3ad1c31ffd1ec1d.zip
Make CallExpr::getCalleeDecl look through pointer derefs.
llvm-svn: 113620
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 5feef1c8033..cf3eea959e8 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -559,6 +559,14 @@ CallExpr::CallExpr(ASTContext &C, StmtClass SC, EmptyShell Empty)
Decl *CallExpr::getCalleeDecl() {
Expr *CEE = getCallee()->IgnoreParenCasts();
+ // If we're calling a dereference, look at the pointer instead.
+ if (BinaryOperator *BO = dyn_cast<BinaryOperator>(CEE)) {
+ if (BO->isPtrMemOp())
+ CEE = BO->getRHS()->IgnoreParenCasts();
+ } else if (UnaryOperator *UO = dyn_cast<UnaryOperator>(CEE)) {
+ if (UO->getOpcode() == UO_Deref)
+ CEE = UO->getSubExpr()->IgnoreParenCasts();
+ }
if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(CEE))
return DRE->getDecl();
if (MemberExpr *ME = dyn_cast<MemberExpr>(CEE))
OpenPOWER on IntegriCloud