From: John McCall Date: Fri, 23 Oct 2009 08:22:42 +0000 (+0000) Subject: Emit calls using the canonical prototype of the called function. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00a1ad9a34f1006d8729aa3fab4fb5f233ab5a55;p=clang 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 --- 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.