comparison gen/classes.cpp @ 802:28ce72c60a21

Fixed some problems with the addZeros forward declarations having type mismatches.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sat, 29 Nov 2008 20:57:52 +0100
parents c8d9b30a0dc2
children c62c6936635b
comparison
equal deleted inserted replaced
801:c8d9b30a0dc2 802:28ce72c60a21
418 418
419 // do typeinfo ? 419 // do typeinfo ?
420 if (needs_definition) 420 if (needs_definition)
421 DtoTypeInfoOf(cd->type, false); 421 DtoTypeInfoOf(cd->type, false);
422 } 422 }
423
424 //////////////////////////////////////////////////////////////////////////////////////////
425
426 void addZeros(std::vector<llvm::Constant*>& inits, size_t pos, size_t offset); // irstruct.cpp
427 423
428 ////////////////////////////////////////////////////////////////////////////// 424 //////////////////////////////////////////////////////////////////////////////
429 425
430 // adds data fields and interface vtables to the constant initializer of class cd 426 // adds data fields and interface vtables to the constant initializer of class cd
431 static size_t init_class_initializer(std::vector<LLConstant*>& inits, ClassDeclaration* target, ClassDeclaration* cd, size_t offsetbegin) 427 static size_t init_class_initializer(std::vector<LLConstant*>& inits, ClassDeclaration* target, ClassDeclaration* cd, size_t offsetbegin)
545 // Logger::println("vtbl[%d] = %s", k, dsym->toChars()); 541 // Logger::println("vtbl[%d] = %s", k, dsym->toChars());
546 542
547 FuncDeclaration* fd = dsym->isFuncDeclaration(); 543 FuncDeclaration* fd = dsym->isFuncDeclaration();
548 assert(fd); 544 assert(fd);
549 545
546 // if function is abstract,
547 // or class is abstract, and func has no body,
548 // emit a null vtbl entry
550 if (fd->isAbstract() || (cd->isAbstract() && !fd->fbody)) 549 if (fd->isAbstract() || (cd->isAbstract() && !fd->fbody))
551 { 550 {
552 sinits[k] = getNullPtr(getVoidPtrType()); 551 sinits[k] = getNullPtr(getVoidPtrType());
553 } 552 }
554 else 553 else