comparison gen/tocall.cpp @ 933:d3a6f1a96731

Replace assertion with errormessage for unsupported calling conventions. like Pascal. See dstress/run/e/extern_10_A.d
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 04 Feb 2009 00:04:09 +0100
parents 7985bb036db4
children cac9895be400
comparison
equal deleted inserted replaced
932:5e3bb0c3ea8b 933:d3a6f1a96731
31 return 0; 31 return 0;
32 } 32 }
33 33
34 ////////////////////////////////////////////////////////////////////////////////////////// 34 //////////////////////////////////////////////////////////////////////////////////////////
35 35
36 unsigned DtoCallingConv(LINK l) 36 unsigned DtoCallingConv(Loc loc, LINK l)
37 { 37 {
38 if (l == LINKc || l == LINKcpp || l == LINKintrinsic) 38 if (l == LINKc || l == LINKcpp || l == LINKintrinsic)
39 return llvm::CallingConv::C; 39 return llvm::CallingConv::C;
40 else if (l == LINKd || l == LINKdefault) 40 else if (l == LINKd || l == LINKdefault)
41 { 41 {
48 } 48 }
49 // on the other hand, here, it's exactly what we want!!! TODO: right? 49 // on the other hand, here, it's exactly what we want!!! TODO: right?
50 else if (l == LINKwindows) 50 else if (l == LINKwindows)
51 return llvm::CallingConv::X86_StdCall; 51 return llvm::CallingConv::X86_StdCall;
52 else 52 else
53 assert(0 && "Unsupported calling convention"); 53 {
54 error(loc, "unsupported calling convention");
55 fatal();
56 }
54 } 57 }
55 58
56 ////////////////////////////////////////////////////////////////////////////////////////// 59 //////////////////////////////////////////////////////////////////////////////////////////
57 60
58 DValue* DtoVaArg(Loc& loc, Type* type, Expression* valistArg) 61 DValue* DtoVaArg(Loc& loc, Type* type, Expression* valistArg)
233 bool thiscall = tf->usesThis; 236 bool thiscall = tf->usesThis;
234 bool delegatecall = (calleeType->toBasetype()->ty == Tdelegate); 237 bool delegatecall = (calleeType->toBasetype()->ty == Tdelegate);
235 bool nestedcall = tf->usesNest; 238 bool nestedcall = tf->usesNest;
236 bool dvarargs = (tf->linkage == LINKd && tf->varargs == 1); 239 bool dvarargs = (tf->linkage == LINKd && tf->varargs == 1);
237 240
238 unsigned callconv = DtoCallingConv(tf->linkage); 241 unsigned callconv = DtoCallingConv(loc, tf->linkage);
239 242
240 // get callee llvm value 243 // get callee llvm value
241 LLValue* callable = DtoCallableValue(fnval); 244 LLValue* callable = DtoCallableValue(fnval);
242 const LLFunctionType* callableTy = DtoExtractFunctionType(callable->getType()); 245 const LLFunctionType* callableTy = DtoExtractFunctionType(callable->getType());
243 assert(callableTy); 246 assert(callableTy);