Mercurial > projects > ldc
comparison gen/structs.cpp @ 486:a34078905d01
Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Reimplemented support for nested functions/class using a new approach.
Added error on taking address of intrinsic.
Fixed problems with the ->syntaxCopy of TypeFunction delegate exp.
Removed DtoDType and replaced all uses with ->toBasetype() instead.
Removed unused inplace stuff.
Fixed a bunch of issues in the runtime unittests, not complete yet.
Added mini tests.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Sun, 10 Aug 2008 08:37:38 +0200 |
parents | 56265fa07c7d |
children | fbb1a366cfbc |
comparison
equal
deleted
inserted
replaced
485:50f6e2337a6b | 486:a34078905d01 |
---|---|
65 ptr = gIR->ir->CreateBitCast(ptr, st, "tmp"); | 65 ptr = gIR->ir->CreateBitCast(ptr, st, "tmp"); |
66 } | 66 } |
67 | 67 |
68 for (unsigned i=0; i<sd->fields.dim; ++i) { | 68 for (unsigned i=0; i<sd->fields.dim; ++i) { |
69 VarDeclaration* vd = (VarDeclaration*)sd->fields.data[i]; | 69 VarDeclaration* vd = (VarDeclaration*)sd->fields.data[i]; |
70 Type* vdtype = DtoDType(vd->type); | 70 Type* vdtype = vd->type->toBasetype(); |
71 //Logger::println("found %u type %s", vd->offset, vdtype->toChars()); | 71 //Logger::println("found %u type %s", vd->offset, vdtype->toChars()); |
72 assert(vd->ir.irField->index >= 0); | 72 assert(vd->ir.irField->index >= 0); |
73 if (os == vd->offset && vdtype == t) { | 73 if (os == vd->offset && vdtype == t) { |
74 idxs.push_back(vd->ir.irField->index); | 74 idxs.push_back(vd->ir.irField->index); |
75 ptr = DtoGEPi(ptr, idxs, "tmp"); | 75 ptr = DtoGEPi(ptr, idxs, "tmp"); |
123 LOG_SCOPE; | 123 LOG_SCOPE; |
124 | 124 |
125 if (sd->prot() == PROTprivate && sd->getModule() != gIR->dmodule) | 125 if (sd->prot() == PROTprivate && sd->getModule() != gIR->dmodule) |
126 Logger::println("using a private struct from outside its module"); | 126 Logger::println("using a private struct from outside its module"); |
127 | 127 |
128 TypeStruct* ts = (TypeStruct*)DtoDType(sd->type); | 128 TypeStruct* ts = (TypeStruct*)sd->type->toBasetype(); |
129 | 129 |
130 bool ispacked = (ts->alignsize() == 1); | 130 bool ispacked = (ts->alignsize() == 1); |
131 | 131 |
132 IrStruct* irstruct = new IrStruct(ts); | 132 IrStruct* irstruct = new IrStruct(ts); |
133 sd->ir.irStruct = irstruct; | 133 sd->ir.irStruct = irstruct; |
277 sd->ir.declared = true; | 277 sd->ir.declared = true; |
278 | 278 |
279 Logger::println("DtoDeclareStruct(%s): %s", sd->toChars(), sd->loc.toChars()); | 279 Logger::println("DtoDeclareStruct(%s): %s", sd->toChars(), sd->loc.toChars()); |
280 LOG_SCOPE; | 280 LOG_SCOPE; |
281 | 281 |
282 TypeStruct* ts = (TypeStruct*)DtoDType(sd->type); | 282 TypeStruct* ts = (TypeStruct*)sd->type->toBasetype(); |
283 | 283 |
284 std::string initname("_D"); | 284 std::string initname("_D"); |
285 initname.append(sd->mangle()); | 285 initname.append(sd->mangle()); |
286 initname.append("6__initZ"); | 286 initname.append("6__initZ"); |
287 | 287 |