From 2b1832e445a3f2796e231337d3ad1c31ffd1ec1d Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Fri, 10 Sep 2010 20:55:30 +0000 Subject: Make CallExpr::getCalleeDecl look through pointer derefs. llvm-svn: 113620 --- clang/lib/AST/Expr.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'clang/lib/AST/Expr.cpp') 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(CEE)) { + if (BO->isPtrMemOp()) + CEE = BO->getRHS()->IgnoreParenCasts(); + } else if (UnaryOperator *UO = dyn_cast(CEE)) { + if (UO->getOpcode() == UO_Deref) + CEE = UO->getSubExpr()->IgnoreParenCasts(); + } if (DeclRefExpr *DRE = dyn_cast(CEE)) return DRE->getDecl(); if (MemberExpr *ME = dyn_cast(CEE)) -- cgit v1.2.3