From 8a9f3fd8bb14a64a31a29bf5cf5376b643218b71 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 11 Sep 2009 22:25:00 +0000 Subject: Set the calling convention based on the CGFunctionInfo. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81582 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index ba9828c879..33a84036ef 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1386,6 +1386,13 @@ RValue CodeGenFunction::EmitCall(llvm::Value *Callee, QualType CalleeType, CallArgList Args; EmitCallArgs(Args, FnType->getAsFunctionProtoType(), ArgBeg, ArgEnd); - return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), + // FIXME: We should not need to do this, it should be part of the function + // type. + unsigned CallingConvention = 0; + if (const llvm::Function *F = + dyn_cast(Callee->stripPointerCasts())) + CallingConvention = F->getCallingConv(); + return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args, + CallingConvention), Callee, Args, TargetDecl); } -- cgit v1.2.3