Mercurial > projects > ldc
diff gen/structs.cpp @ 1149:5ebe8224988b
Fixed problems introduced by previous commits that prevented Tango from compiling.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Fri, 27 Mar 2009 23:17:04 +0100 |
parents | 3d1b16dabd25 |
children | 3cf0066e6faf |
line wrap: on
line diff
--- a/gen/structs.cpp Fri Mar 27 21:50:32 2009 +0100 +++ b/gen/structs.cpp Fri Mar 27 23:17:04 2009 +0100 @@ -97,16 +97,7 @@ TypeStruct* ts = (TypeStruct*)si->ad->type; // force constant initialization of the symbol - si->ad->codegen(Type::sir);; - - // get formal type - const llvm::StructType* structtype = isaStruct(ts->ir.type->get()); - -#if 0 - // log it - if (Logger::enabled()) - Logger::cout() << "llvm struct type: " << *structtype << '\n'; -#endif + si->ad->codegen(Type::sir); // sanity check assert(si->value.dim > 0); @@ -241,7 +232,7 @@ } // there might still be padding after the last one, make sure that is defaulted/zeroed as well - size_t structsize = getTypePaddedSize(structtype); + size_t structsize = si->ad->structsize; // if there is space before the next explicit initializer // FIXME: this should be handled in the loop above as well @@ -645,6 +636,15 @@ // refine __initZ global type to the one of the initializer llvm::cast<llvm::OpaqueType>(irstruct->initOpaque.get())->refineAbstractTypeTo(irstruct->constInit->getType()); + // build initializers for static member variables + size_t n = irstruct->staticVars.size(); + for (size_t i = 0; i < n; ++i) + { + DtoConstInitGlobal(irstruct->staticVars[i]); + } + // This is all we use it for. Clear the memory! + irstruct->staticVars.clear(); + gIR->structs.pop_back(); // emit typeinfo