[svn r122] Fixed temporary delegates can now alloca their own storage.

This commit is contained in:
Tomas Lindquist Olsen
2007-11-26 05:50:33 +01:00
parent e0176785c7
commit 26beb7f43d
2 changed files with 9 additions and 3 deletions

View File

@@ -91,7 +91,7 @@ void DtoArrayAssign(llvm::Value* dst, llvm::Value* src)
}
else
{
Logger::cout() << "array assignment type dont match: " << *dst->getType() << '\n' << *src->getType() << '\n';
Logger::cout() << "array assignment type dont match: " << *dst->getType() << "\n\n" << *src->getType() << '\n';
const llvm::ArrayType* arrty = isaArray(src->getType()->getContainedType(0));
if (!arrty)
{

View File

@@ -2079,8 +2079,14 @@ DValue* DelegateExp::toElem(IRState* p)
const llvm::Type* int8ptrty = llvm::PointerType::get(llvm::Type::Int8Ty);
assert(p->topexp() && p->topexp()->e2 == this && p->topexp()->v);
llvm::Value* lval = p->topexp()->v->getLVal();
llvm::Value* lval;
if (p->topexp() && p->topexp()->e2 == this) {
assert(p->topexp()->v);
lval = p->topexp()->v->getLVal();
}
else {
lval = new llvm::AllocaInst(DtoType(type), "tmpdelegate", p->topallocapoint());
}
llvm::Value* context = DtoGEP(lval,zero,zero,"tmp",p->scopebb());
llvm::Value* castcontext = new llvm::BitCastInst(u->getRVal(),int8ptrty,"tmp",p->scopebb());