Mercurial > projects > ldc
diff gen/toir.cpp @ 118:d580b95cce2b trunk
[svn r122] Fixed temporary delegates can now alloca their own storage.
author | lindquist |
---|---|
date | Mon, 26 Nov 2007 05:50:33 +0100 |
parents | fd7ad91fd713 |
children | 79c9ac745fbc |
line wrap: on
line diff
--- a/gen/toir.cpp Mon Nov 26 04:49:23 2007 +0100 +++ b/gen/toir.cpp Mon Nov 26 05:50:33 2007 +0100 @@ -2079,8 +2079,14 @@ 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());