Added type param to DVarValue as DMD sometimes overrides the type of the VarDeclaration.

Added support for align(1)/packed structs, other alignments are still ignored.
Fixed some problems with accessing lazy arguments.
This commit is contained in:
Tomas Lindquist Olsen
2008-07-30 10:12:55 +02:00
parent 3b21ae25be
commit 905ca019dd
11 changed files with 43 additions and 32 deletions

View File

@@ -13,20 +13,21 @@
//////////////////////////////////////////////////////////////////////////////////////////
TypeFunction* DtoTypeFunction(Type* type)
TypeFunction* DtoTypeFunction(DValue* fnval)
{
TypeFunction* tf = 0;
type = type->toBasetype();
Type* type = fnval->getType()->toBasetype();
if (type->ty == Tfunction)
{
tf = (TypeFunction*)type;
return (TypeFunction*)type;
}
else if (type->ty == Tdelegate)
{
assert(type->next->ty == Tfunction);
tf = (TypeFunction*)type->next;
return (TypeFunction*)type->next;
}
return tf;
assert(0 && "cant get TypeFunction* from non lazy/function/delegate");
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -192,8 +193,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
bool va_intrinsic = (dfnval && dfnval->func && (dfnval->func->llvmInternal == LLVMva_intrinsic));
// get function type info
TypeFunction* tf = DtoTypeFunction(calleeType);
assert(tf);
TypeFunction* tf = DtoTypeFunction(fnval);
// misc
bool retinptr = tf->llvmRetInPtr;