From 00a1ad9a34f1006d8729aa3fab4fb5f233ab5a55 Mon Sep 17 00:00:00 2001 From: John McCall Date: Fri, 23 Oct 2009 08:22:42 +0000 Subject: Emit calls using the canonical prototype of the called function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84947 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index bfbd6f70bc..bb487f6e3f 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1547,11 +1547,13 @@ RValue CodeGenFunction::EmitCall(llvm::Value *Callee, QualType CalleeType, assert(CalleeType->isFunctionPointerType() && "Call must have function pointer type!"); - QualType FnType = CalleeType->getAs()->getPointeeType(); - QualType ResultType = FnType->getAs()->getResultType(); + CalleeType = getContext().getCanonicalType(CalleeType); + + QualType FnType = cast(CalleeType)->getPointeeType(); + QualType ResultType = cast(FnType)->getResultType(); CallArgList Args; - EmitCallArgs(Args, FnType->getAs(), ArgBeg, ArgEnd); + EmitCallArgs(Args, dyn_cast(FnType), ArgBeg, ArgEnd); // FIXME: We should not need to do this, it should be part of the function // type. -- cgit v1.2.3