Mercurial > projects > ldc
changeset 119:79c9ac745fbc trunk
[svn r123] Fixed some typeinfo module name mismatches.
Fixed D-style varargs returning through pointer.
Fixed converting nested function to delegate.
Added std.string and std.format to Phobos.
author | lindquist |
---|---|
date | Mon, 26 Nov 2007 06:45:13 +0100 |
parents | d580b95cce2b |
children | 5ce8ab11e75a |
files | gen/functions.cpp gen/toir.cpp llvmdc.kdevelop.filelist lphobos/phobos.d lphobos/typeinfo1/ti_cdouble.d lphobos/typeinfo1/ti_cfloat.d lphobos/typeinfo1/ti_creal.d lphobos/typeinfo2/ti_AC.d lphobos/typeinfo2/ti_C.d test/bug74.d test/bug75.d |
diffstat | 11 files changed, 61 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/functions.cpp Mon Nov 26 05:50:33 2007 +0100 +++ b/gen/functions.cpp Mon Nov 26 06:45:13 2007 +0100 @@ -396,9 +396,16 @@ assert(fdecl->llvmThisVar); ++iarg; } - int varargs = -1; - if (f->linkage == LINKd && f->varargs == 1) - varargs = 0; + + if (f->linkage == LINKd && f->varargs == 1) { + iarg->setName("_arguments"); + fdecl->llvmArguments = iarg; + ++iarg; + iarg->setName("_argptr"); + fdecl->llvmArgPtr = iarg; + ++iarg; + } + for (; iarg != func->arg_end(); ++iarg) { Argument* arg = Argument::getNth(f->parameters, k++); @@ -410,19 +417,6 @@ } iarg->setName(arg->ident->toChars()); } - else if (!arg && varargs >= 0) { - if (varargs == 0) { - iarg->setName("_arguments"); - fdecl->llvmArguments = iarg; - } - else if (varargs == 1) { - iarg->setName("_argptr"); - fdecl->llvmArgPtr = iarg; - } - else - assert(0); - varargs++; - } else { iarg->setName("unnamed"); }
--- a/gen/toir.cpp Mon Nov 26 05:50:33 2007 +0100 +++ b/gen/toir.cpp Mon Nov 26 06:45:13 2007 +0100 @@ -2088,17 +2088,31 @@ lval = new llvm::AllocaInst(DtoType(type), "tmpdelegate", p->topallocapoint()); } + llvm::Value* uval; + if (DFuncValue* f = u->isFunc()) { + //assert(f->vthis); + //uval = f->vthis; + llvm::Value* nestvar = p->func()->decl->llvmNested; + if (nestvar) + uval = nestvar; + else + uval = llvm::ConstantPointerNull::get(llvm::PointerType::get(llvm::Type::Int8Ty)); + } + else { + uval = u->getRVal(); + } + llvm::Value* context = DtoGEP(lval,zero,zero,"tmp",p->scopebb()); - llvm::Value* castcontext = new llvm::BitCastInst(u->getRVal(),int8ptrty,"tmp",p->scopebb()); + llvm::Value* castcontext = DtoBitCast(uval,int8ptrty); new llvm::StoreInst(castcontext, context, p->scopebb()); llvm::Value* fptr = DtoGEP(lval,zero,one,"tmp",p->scopebb()); assert(func->llvmValue); - llvm::Value* castfptr = new llvm::BitCastInst(func->llvmValue,fptr->getType()->getContainedType(0),"tmp",p->scopebb()); + llvm::Value* castfptr = DtoBitCast(func->llvmValue,fptr->getType()->getContainedType(0)); new llvm::StoreInst(castfptr, fptr, p->scopebb()); - return new DImValue(type, u->getRVal(), true); + return new DVarValue(type, lval, true); } //////////////////////////////////////////////////////////////////////////////////////////
--- a/llvmdc.kdevelop.filelist Mon Nov 26 05:50:33 2007 +0100 +++ b/llvmdc.kdevelop.filelist Mon Nov 26 06:45:13 2007 +0100 @@ -323,6 +323,8 @@ test/bug71.d test/bug72.d test/bug73.d +test/bug74.d +test/bug75.d test/bug8.d test/bug9.d test/c.d
--- a/lphobos/phobos.d Mon Nov 26 05:50:33 2007 +0100 +++ b/lphobos/phobos.d Mon Nov 26 06:45:13 2007 +0100 @@ -3,6 +3,7 @@ import std.array, std.ctype, +std.format, std.intrinsic, std.math, std.moduleinit, @@ -10,12 +11,10 @@ std.stdint, std.stdio, std.stdarg, +std.string, std.uni, std.utf, -//std.format, -//std.string, - std.c.fenv, std.c.locale, std.c.math,
--- a/lphobos/typeinfo1/ti_cdouble.d Mon Nov 26 05:50:33 2007 +0100 +++ b/lphobos/typeinfo1/ti_cdouble.d Mon Nov 26 06:45:13 2007 +0100 @@ -1,7 +1,7 @@ // cdouble -module std.typeinfo.ti_cdouble; +module typeinfo1.ti_cdouble; class TypeInfo_r : TypeInfo {
--- a/lphobos/typeinfo1/ti_cfloat.d Mon Nov 26 05:50:33 2007 +0100 +++ b/lphobos/typeinfo1/ti_cfloat.d Mon Nov 26 06:45:13 2007 +0100 @@ -1,7 +1,7 @@ // cfloat -module std.typeinfo.ti_cfloat; +module typeinfo1.ti_cfloat; class TypeInfo_q : TypeInfo {
--- a/lphobos/typeinfo1/ti_creal.d Mon Nov 26 05:50:33 2007 +0100 +++ b/lphobos/typeinfo1/ti_creal.d Mon Nov 26 06:45:13 2007 +0100 @@ -1,7 +1,7 @@ // creal -module std.typeinfo.ti_creal; +module typeinfo1.ti_creal; class TypeInfo_c : TypeInfo {
--- a/lphobos/typeinfo2/ti_AC.d Mon Nov 26 05:50:33 2007 +0100 +++ b/lphobos/typeinfo2/ti_AC.d Mon Nov 26 06:45:13 2007 +0100 @@ -1,4 +1,4 @@ -module std.typeinfo.ti_AC; +module typeinfo2.ti_AC; // Object[]
--- a/lphobos/typeinfo2/ti_C.d Mon Nov 26 05:50:33 2007 +0100 +++ b/lphobos/typeinfo2/ti_C.d Mon Nov 26 06:45:13 2007 +0100 @@ -21,7 +21,7 @@ * distribution. */ -module std.typeinfo.ti_C; +module typeinfo2.ti_C; // Object