changeset 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 56a21f3e5d3e
children 79c9ac745fbc
files gen/arrays.cpp gen/toir.cpp
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gen/arrays.cpp	Mon Nov 26 04:49:23 2007 +0100
+++ b/gen/arrays.cpp	Mon Nov 26 05:50:33 2007 +0100
@@ -91,7 +91,7 @@
     }
     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)
         {
--- 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());