# HG changeset patch # User Tomas Lindquist Olsen # Date 1227988672 -3600 # Node ID 28ce72c60a212e2729e33f805eb994a2850251d2 # Parent c8d9b30a0dc2e9582b396859e66933b34eb58f34 Fixed some problems with the addZeros forward declarations having type mismatches. diff -r c8d9b30a0dc2 -r 28ce72c60a21 gen/classes.cpp --- a/gen/classes.cpp Sat Nov 29 18:28:32 2008 +0100 +++ b/gen/classes.cpp Sat Nov 29 20:57:52 2008 +0100 @@ -421,10 +421,6 @@ DtoTypeInfoOf(cd->type, false); } -////////////////////////////////////////////////////////////////////////////////////////// - -void addZeros(std::vector& inits, size_t pos, size_t offset); // irstruct.cpp - ////////////////////////////////////////////////////////////////////////////// // adds data fields and interface vtables to the constant initializer of class cd @@ -547,6 +543,9 @@ FuncDeclaration* fd = dsym->isFuncDeclaration(); assert(fd); + // if function is abstract, + // or class is abstract, and func has no body, + // emit a null vtbl entry if (fd->isAbstract() || (cd->isAbstract() && !fd->fbody)) { sinits[k] = getNullPtr(getVoidPtrType()); diff -r c8d9b30a0dc2 -r 28ce72c60a21 gen/structs.cpp --- a/gen/structs.cpp Sat Nov 29 18:28:32 2008 +0100 +++ b/gen/structs.cpp Sat Nov 29 20:57:52 2008 +0100 @@ -18,7 +18,6 @@ #include "ir/irstruct.h" ////////////////////////////////////////////////////////////////////////////////////////// -void addZeros(std::vector& inits, unsigned pos, unsigned offset); // defined in irstruct.cpp // pair of var and its init typedef std::pair VarInitPair; diff -r c8d9b30a0dc2 -r 28ce72c60a21 gen/toir.cpp --- a/gen/toir.cpp Sat Nov 29 18:28:32 2008 +0100 +++ b/gen/toir.cpp Sat Nov 29 20:57:52 2008 +0100 @@ -2277,8 +2277,6 @@ ////////////////////////////////////////////////////////////////////////////////////////// -void addZeros(std::vector& inits, unsigned pos, unsigned offset); - DValue* StructLiteralExp::toElem(IRState* p) { Logger::print("StructLiteralExp::toElem: %s | %s\n", toChars(), type->toChars()); @@ -2362,8 +2360,6 @@ ////////////////////////////////////////////////////////////////////////////////////////// -void addZeros(std::vector& inits, unsigned pos, unsigned offset); - LLConstant* StructLiteralExp::toConstElem(IRState* p) { Logger::print("StructLiteralExp::toConstElem: %s | %s\n", toChars(), type->toChars()); diff -r c8d9b30a0dc2 -r 28ce72c60a21 ir/irstruct.cpp --- a/ir/irstruct.cpp Sat Nov 29 18:28:32 2008 +0100 +++ b/ir/irstruct.cpp Sat Nov 29 20:57:52 2008 +0100 @@ -120,8 +120,6 @@ ////////////////////////////////////////// -void addZeros(std::vector& inits, size_t pos, size_t offset); - void IrStruct::addVar(VarDeclaration * var) { TypeVector* tvec = &types; diff -r c8d9b30a0dc2 -r 28ce72c60a21 ir/irstruct.h --- a/ir/irstruct.h Sat Nov 29 18:28:32 2008 +0100 +++ b/ir/irstruct.h Sat Nov 29 20:57:52 2008 +0100 @@ -8,6 +8,10 @@ struct IrInterface; +void addZeros(std::vector& inits, size_t pos, size_t offset); +void addZeros(std::vector& inits, size_t pos, size_t offset); +void addZeros(std::vector& inits, size_t pos, size_t offset); + ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////