Mercurial > projects > ldc
comparison gen/classes.cpp @ 1262:ec1d9dc1d32a
Fixed struct default initializers.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Sat, 25 Apr 2009 18:26:54 +0200 |
parents | 752bed475b75 |
children | dd135ff697fa |
comparison
equal
deleted
inserted
replaced
1257:7af860e4f403 | 1262:ec1d9dc1d32a |
---|---|
185 | 185 |
186 void DtoInitClass(TypeClass* tc, LLValue* dst) | 186 void DtoInitClass(TypeClass* tc, LLValue* dst) |
187 { | 187 { |
188 tc->sym->codegen(Type::sir); | 188 tc->sym->codegen(Type::sir); |
189 | 189 |
190 size_t presz = 2*getTypePaddedSize(DtoSize_t()); | 190 uint64_t n = tc->sym->structsize - PTRSIZE * 2; |
191 uint64_t n = getTypePaddedSize(tc->ir.type->get()) - presz; | |
192 | 191 |
193 // set vtable field seperately, this might give better optimization | 192 // set vtable field seperately, this might give better optimization |
194 LLValue* tmp = DtoGEPi(dst,0,0,"vtbl"); | 193 LLValue* tmp = DtoGEPi(dst,0,0,"vtbl"); |
195 LLValue* val = DtoBitCast(tc->sym->ir.irStruct->getVtblSymbol(), tmp->getType()->getContainedType(0)); | 194 LLValue* val = DtoBitCast(tc->sym->ir.irStruct->getVtblSymbol(), tmp->getType()->getContainedType(0)); |
196 DtoStore(val, tmp); | 195 DtoStore(val, tmp); |