diff gen/classes.cpp @ 275:665b81613475 trunk

[svn r296] Removed: the 'suite' dir, it never took off! Fixed: foreach statement, key-type checks were buggy. Fixed: setting LLVMDC versions on the command line is now an error. Fixed: array compare runtime had incorrect param attrs on call. Fixed: index expressions on dynamic array slices w/o storage was broken. Fixed: scope classes had incorrect finalization in some cases. Fixed: when outputting !ClassInfoS !OffsetTypeInfoS, static class members were trying to be included, crashing the compiler. Fixed: calling LLVMDC with -inline but not any -O option caused assertion failure. Changed: the runtime now uses a single interface to "get" to !TypeInfoS, part of eliminating duplicate !TypeInfo codegen.
author lindquist
date Thu, 19 Jun 2008 17:30:32 +0200
parents 1e6e2b5d5bfe
children 70c370e97944
line wrap: on
line diff
--- a/gen/classes.cpp	Thu Jun 19 13:54:31 2008 +0200
+++ b/gen/classes.cpp	Thu Jun 19 17:30:32 2008 +0200
@@ -447,7 +447,7 @@
 
     // typeinfo
     if (needs_definition)
-        cd->type->getTypeInfo(NULL);
+        DtoTypeInfoOf(cd->type, false);
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -1255,16 +1255,12 @@
     size_t offset = gTargetData->getStructLayout(isaStruct(cd->type->ir.type->get()))->getElementOffset(vd->ir.irField->index+2);
     inits.push_back(DtoConstSize_t(offset));
 
-    vd->type->getTypeInfo(NULL);
-    assert(vd->type->vtinfo);
-    DtoForceDeclareDsymbol(vd->type->vtinfo);
-    LLConstant* c = isaConstant(vd->type->vtinfo->ir.getIrValue());
-
-    const LLType* tiTy = getPtrToType(Type::typeinfo->type->ir.type->get());
+    LLConstant* c = DtoTypeInfoOf(vd->type, true);
+    const LLType* tiTy = c->getType();
     //Logger::cout() << "tiTy = " << *tiTy << '\n';
 
     types.push_back(tiTy);
-    inits.push_back(llvm::ConstantExpr::getBitCast(c, tiTy));
+    inits.push_back(c);
 
     const llvm::StructType* sTy = llvm::StructType::get(types);
     return llvm::ConstantStruct::get(sTy, inits);
@@ -1285,9 +1281,12 @@
         Dsymbol *sm = (Dsymbol *)cd2->members->data[i];
         if (VarDeclaration* vd = sm->isVarDeclaration()) // is this enough?
         {
-            LLConstant* c = build_offti_entry(cd, vd);
-            assert(c);
-            arrayInits.push_back(c);
+            if (!vd->isDataseg()) // static members dont have an offset!
+            {
+                LLConstant* c = build_offti_entry(cd, vd);
+                assert(c);
+                arrayInits.push_back(c);
+            }
         }
         }
     }
@@ -1389,7 +1388,7 @@
         for (size_t i = 0; i < cd2->members->dim; i++)
         {
         Dsymbol *sm = (Dsymbol *)cd2->members->data[i];
-        if (sm->isVarDeclaration()) // is this enough?
+        if (sm->isVarDeclaration() && !sm->isVarDeclaration()->isDataseg()) // is this enough?
             hasOffTi = true;
         //printf("sm = %s %s\n", sm->kind(), sm->toChars());
         if (sm->hasPointers())