Mercurial > projects > ldc
comparison gen/classes.cpp @ 190:36044016709a trunk
[svn r206] Fixed some interfaceInfo related issues, closes #44
author | lindquist |
---|---|
date | Mon, 12 May 2008 14:32:29 +0200 |
parents | cea8dcfa76df |
children | 67ed21bf16af |
comparison
equal
deleted
inserted
replaced
189:3aed08fb64f4 | 190:36044016709a |
---|---|
432 void DtoConstInitClass(ClassDeclaration* cd) | 432 void DtoConstInitClass(ClassDeclaration* cd) |
433 { | 433 { |
434 if (cd->ir.initialized) return; | 434 if (cd->ir.initialized) return; |
435 cd->ir.initialized = true; | 435 cd->ir.initialized = true; |
436 | 436 |
437 if (cd->isInterfaceDeclaration()) | |
438 return; // nothing to do | |
439 | |
440 Logger::println("DtoConstInitClass(%s): %s", cd->toPrettyChars(), cd->loc.toChars()); | 437 Logger::println("DtoConstInitClass(%s): %s", cd->toPrettyChars(), cd->loc.toChars()); |
441 LOG_SCOPE; | 438 LOG_SCOPE; |
442 | 439 |
443 IrStruct* irstruct = cd->ir.irStruct; | 440 IrStruct* irstruct = cd->ir.irStruct; |
444 gIR->structs.push_back(irstruct); | 441 gIR->structs.push_back(irstruct); |
461 | 458 |
462 // fill out fieldtypes/inits | 459 // fill out fieldtypes/inits |
463 std::vector<llvm::Constant*> fieldinits; | 460 std::vector<llvm::Constant*> fieldinits; |
464 | 461 |
465 // first field is always the vtable | 462 // first field is always the vtable |
466 if (cd->isAbstract()) | 463 if (cd->isAbstract() || cd->isInterfaceDeclaration()) |
467 { | 464 { |
468 fieldinits.push_back( | 465 const llvm::Type* ptrTy = getPtrToType(ts->ir.vtblType->get()); |
469 llvm::ConstantPointerNull::get( | 466 fieldinits.push_back(llvm::Constant::getNullValue(ptrTy)); |
470 getPtrToType( | |
471 ts->ir.vtblType->get() | |
472 ) | |
473 ) | |
474 ); | |
475 } | 467 } |
476 else | 468 else |
477 { | 469 { |
478 assert(cd->ir.irStruct->vtbl != 0); | 470 assert(cd->ir.irStruct->vtbl != 0); |
479 fieldinits.push_back(cd->ir.irStruct->vtbl); | 471 fieldinits.push_back(cd->ir.irStruct->vtbl); |