diff gen/llvmhelpers.cpp @ 648:8d850fa25713

Fix VarDecls for tuples. Closes #99. I've implemented it this way since it doesn't require any changes in the frontend. However, I think having TypeTuple expressed as LLVM struct types would make much more sense and open the door to tuple lvalues.
author Christian Kamm <kamm incasoftware de>
date Sun, 05 Oct 2008 11:47:47 +0200
parents 8aebdf56c455
children c42173b3557b
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp	Sat Oct 04 23:28:49 2008 +0200
+++ b/gen/llvmhelpers.cpp	Sun Oct 05 11:47:47 2008 +0200
@@ -1129,6 +1129,12 @@
     {
         Logger::println("VarDeclaration");
 
+        // if aliassym is set, this VarDecl is redone as an alias to another symbol
+        // this seems to be done to rewrite Tuple!(...) v;
+        // as a TupleDecl that contains a bunch of individual VarDecls
+        if (vd->aliassym)
+            return DtoDeclarationExp(vd->aliassym);
+
         // static
         if (vd->isDataseg())
         {
@@ -1249,6 +1255,22 @@
             DtoDeclarationExp(mdsym);
         }
     }
+    // tuple declaration
+    else if (TupleDeclaration* tupled = declaration->isTupleDeclaration())
+    {
+        Logger::println("TupleDeclaration");
+        if(!tupled->isexp) {
+            error(declaration->loc, "don't know how to handle non-expression tuple decls yet");
+            assert(0);
+        }
+
+        assert(tupled->objects);
+        for (int i=0; i < tupled->objects->dim; ++i)
+        {
+            DsymbolExp* exp = (DsymbolExp*)tupled->objects->data[i];
+            DtoDeclarationExp(exp->s);
+        }
+    }
     // unsupported declaration
     else
     {