Changeset 801:c8d9b30a0dc2
- Timestamp:
- 11/29/08 12:28:32
(1 month ago)
- Author:
- Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
- Parents:
800:d14e4594c7d7 799:9f92b6e40fd3
- branch:
- default
- Message:
merge
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r799 |
r801 |
|
| 425 | 425 | |
|---|
| 426 | 426 | void addZeros(std::vector<llvm::Constant*>& inits, size_t pos, size_t offset); // irstruct.cpp |
|---|
| 427 | | |
|---|
| 428 | | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 429 | | |
|---|
| 430 | | // assigns constant initializers to fields introduced by cd |
|---|
| 431 | | static void init_field_inits(ClassDeclaration* cd) |
|---|
| 432 | | { |
|---|
| 433 | | size_t n = cd->fields.dim; |
|---|
| 434 | | for (size_t i=0; i<n; i++) |
|---|
| 435 | | { |
|---|
| 436 | | VarDeclaration* v = (VarDeclaration*)cd->fields.data[i]; |
|---|
| 437 | | IrField* f = v->ir.irField; |
|---|
| 438 | | assert(!f->constInit); |
|---|
| 439 | | f->constInit = DtoConstFieldInitializer(v->loc, v->type, v->init); |
|---|
| 440 | | } |
|---|
| 441 | | } |
|---|
| 442 | 427 | |
|---|
| 443 | 428 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| … | … | |
| 503 | 488 | |
|---|
| 504 | 489 | // add the field |
|---|
| 505 | | assert(var->ir.irField->constInit); |
|---|
| | 490 | // and build its constant initializer lazily |
|---|
| | 491 | if (!var->ir.irField->constInit) |
|---|
| | 492 | var->ir.irField->constInit = DtoConstFieldInitializer(var->loc, var->type, var->init); |
|---|
| 506 | 493 | inits.push_back(var->ir.irField->constInit); |
|---|
| 507 | 494 | |
|---|
| … | … | |
| 731 | 718 | const llvm::ArrayType* vtbltype = isaArray(irstruct->vtblTy.get()); |
|---|
| 732 | 719 | assert(vtbltype); |
|---|
| 733 | | |
|---|
| 734 | | // make sure each field knows its default initializer |
|---|
| 735 | | init_field_inits(cd); |
|---|
| 736 | 720 | |
|---|
| 737 | 721 | // build initializer list |
|---|
| r800 |
r801 |
|
| 548 | 548 | assert(fd); |
|---|
| 549 | 549 | |
|---|
| 550 | | if (fd->isAbstract()) |
|---|
| | 550 | if (fd->isAbstract() || (cd->isAbstract() && !fd->fbody)) |
|---|
| 551 | 551 | { |
|---|
| 552 | 552 | sinits[k] = getNullPtr(getVoidPtrType()); |
|---|