Mercurial > projects > ldc
diff gen/tocall.cpp @ 435:74101be2a553
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.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 30 Jul 2008 10:12:55 +0200 |
parents | fa91b03d9cd7 |
children | cc40db549aea |
line wrap: on
line diff
--- a/gen/tocall.cpp Wed Jul 30 09:21:06 2008 +0200 +++ b/gen/tocall.cpp Wed Jul 30 10:12:55 2008 +0200 @@ -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 @@ 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;