diff gen/structs.cpp @ 1270:dd135ff697fa

Fixed class default initializers and type generation. Bug #260 is fixed.
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Mon, 27 Apr 2009 03:40:40 +0200
parents 3ddec21fe2b6
children 8fb39f7f1a7c
line wrap: on
line diff
--- a/gen/structs.cpp	Mon Apr 27 01:43:29 2009 +0200
+++ b/gen/structs.cpp	Mon Apr 27 03:40:40 2009 +0200
@@ -44,13 +44,13 @@
     IrStruct* irstruct = new IrStruct(sd);
     sd->ir.irStruct = irstruct;
 
-    // emit the initZ symbol
-    LLGlobalVariable* initZ = irstruct->getInitSymbol();
-
     // perform definition
     bool needs_def = mustDefineSymbol(sd);
     if (needs_def)
     {
+        // emit the initZ symbol
+        LLGlobalVariable* initZ = irstruct->getInitSymbol();
+
         // set initZ initializer
         initZ->setInitializer(irstruct->getDefaultInit());
     }