From 4da2cf066e84a8f4f9675c4ed7f6f8951aa37c43 Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Sat, 29 Nov 2008 20:57:52 +0100 Subject: [PATCH] Fixed some problems with the addZeros forward declarations having type mismatches. --- gen/classes.cpp | 7 +++---- gen/structs.cpp | 1 - gen/toir.cpp | 4 ---- ir/irstruct.cpp | 2 -- ir/irstruct.h | 4 ++++ 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/gen/classes.cpp b/gen/classes.cpp index b331d3fd..a8debc3c 100644 --- a/gen/classes.cpp +++ b/gen/classes.cpp @@ -421,10 +421,6 @@ void DtoDeclareClass(ClassDeclaration* cd) 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 @@ static void init_class_vtbl_initializer(ClassDeclaration* cd) 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 --git a/gen/structs.cpp b/gen/structs.cpp index 735ba784..b6d836b9 100644 --- a/gen/structs.cpp +++ b/gen/structs.cpp @@ -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 --git a/gen/toir.cpp b/gen/toir.cpp index 6bcf0e1c..7cc239d9 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -2277,8 +2277,6 @@ LLConstant* ArrayLiteralExp::toConstElem(IRState* p) ////////////////////////////////////////////////////////////////////////////////////////// -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 @@ DValue* StructLiteralExp::toElem(IRState* p) ////////////////////////////////////////////////////////////////////////////////////////// -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 --git a/ir/irstruct.cpp b/ir/irstruct.cpp index 3f33eff9..b3b92b2a 100644 --- a/ir/irstruct.cpp +++ b/ir/irstruct.cpp @@ -120,8 +120,6 @@ void IrStruct::popAnon() ////////////////////////////////////////// -void addZeros(std::vector& inits, size_t pos, size_t offset); - void IrStruct::addVar(VarDeclaration * var) { TypeVector* tvec = &types; diff --git a/ir/irstruct.h b/ir/irstruct.h index e566d456..c4d51bd3 100644 --- a/ir/irstruct.h +++ b/ir/irstruct.h @@ -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); + ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////