]> granicus.if.org Git - clang/commitdiff
Emit calls using the canonical prototype of the called function.
authorJohn McCall <rjmccall@apple.com>
Fri, 23 Oct 2009 08:22:42 +0000 (08:22 +0000)
committerJohn McCall <rjmccall@apple.com>
Fri, 23 Oct 2009 08:22:42 +0000 (08:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84947 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp

index bfbd6f70bc98a8abc969e6c3c345150deae3270f..bb487f6e3fdff2d6b3c4ae82c1a0962f02f0ba86 100644 (file)
@@ -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<PointerType>()->getPointeeType();
-  QualType ResultType = FnType->getAs<FunctionType>()->getResultType();
+  CalleeType = getContext().getCanonicalType(CalleeType);
+
+  QualType FnType = cast<PointerType>(CalleeType)->getPointeeType();
+  QualType ResultType = cast<FunctionType>(FnType)->getResultType();
 
   CallArgList Args;
-  EmitCallArgs(Args, FnType->getAs<FunctionProtoType>(), ArgBeg, ArgEnd);
+  EmitCallArgs(Args, dyn_cast<FunctionProtoType>(FnType), ArgBeg, ArgEnd);
 
   // FIXME: We should not need to do this, it should be part of the function
   // type.