mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-04-19 18:29:03 +02:00
[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.
This commit is contained in:
20
gen/toir.cpp
20
gen/toir.cpp
@@ -2088,17 +2088,31 @@ DValue* DelegateExp::toElem(IRState* p)
|
||||
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);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user