From 1ddc9c4674b7c737ec65241a531df8c64e40b0a9 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 6 Sep 2011 21:41:04 +0000 Subject: When extracting the callee declaration from a call expression, be sure to look through SubstNonTypeTemplateParmExprs. Then, update the IR generation of CallExprs to actually use CallExpr::getCalleeDecl() rather than attempting to mimick its behavior (badly). Fixes . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139185 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index d26d787da6..0be3628a62 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -2174,14 +2174,10 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E, if (const CXXMemberCallExpr *CE = dyn_cast(E)) return EmitCXXMemberCallExpr(CE, ReturnValue); - const Decl *TargetDecl = 0; - if (const ImplicitCastExpr *CE = dyn_cast(E->getCallee())) { - if (const DeclRefExpr *DRE = dyn_cast(CE->getSubExpr())) { - TargetDecl = DRE->getDecl(); - if (const FunctionDecl *FD = dyn_cast(TargetDecl)) - if (unsigned builtinID = FD->getBuiltinID()) - return EmitBuiltinExpr(FD, builtinID, E); - } + const Decl *TargetDecl = E->getCalleeDecl(); + if (const FunctionDecl *FD = dyn_cast_or_null(TargetDecl)) { + if (unsigned builtinID = FD->getBuiltinID()) + return EmitBuiltinExpr(FD, builtinID, E); } if (const CXXOperatorCallExpr *CE = dyn_cast(E)) -- cgit v1.2.3