[svn r70] Fixed bug where correct calling convention was not set on calling aggregate methods

This commit is contained in:
Tomas Lindquist Olsen
2007-10-28 02:03:42 +02:00
parent 49deafe227
commit a5d3910b57
2 changed files with 11 additions and 4 deletions

View File

@@ -1254,7 +1254,13 @@ elem* CallExp::toElem(IRState* p)
e->val = call;
// set calling convention
if ((fn->funcdecl && (fn->funcdecl->llvmInternal != LLVMintrinsic && fn->funcdecl->llvmInternal != LLVMva_start)) || delegateCall)
if (fn->funcdecl) {
int li = fn->funcdecl->llvmInternal;
if (li != LLVMintrinsic && li != LLVMva_start && li != LLVMva_intrinsic) {
call->setCallingConv(LLVM_DtoCallingConv(dlink));
}
}
else if (delegateCall)
call->setCallingConv(LLVM_DtoCallingConv(dlink));
else if (fn->callconv != (unsigned)-1)
call->setCallingConv(fn->callconv);
@@ -1600,7 +1606,8 @@ elem* DotVarExp::toElem(IRState* p)
e->callconv = LLVM_DtoCallingConv(fdecl->linkage);
}
e->val = funcval;
e->type = elem::VAL;
e->type = elem::FUNC;
e->funcdecl = fdecl;
}
else {
printf("unknown: %s\n", var->toChars());

View File

@@ -17,12 +17,12 @@ int main()
{
printf("Dot Product test\n");
const float f = 0.7071067811865474617f;
const f = 0.7071067811865474617;
vec3 v = vec3(f,f,0);
vec3 w = vec3(f,0,f);
v.print("v");
v.print("w");
w.print("w");
auto dp = v.dot(w);
printf("v · w = %f\n", dp);