Fixed some problems with the addZeros forward declarations having type mismatches.

This commit is contained in:
Tomas Lindquist Olsen 2008-11-29 20:57:52 +01:00
parent 3a2e29d434
commit 4da2cf066e
5 changed files with 7 additions and 11 deletions

View file

@ -421,10 +421,6 @@ void DtoDeclareClass(ClassDeclaration* cd)
DtoTypeInfoOf(cd->type, false); DtoTypeInfoOf(cd->type, false);
} }
//////////////////////////////////////////////////////////////////////////////////////////
void addZeros(std::vector<llvm::Constant*>& inits, size_t pos, size_t offset); // irstruct.cpp
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// adds data fields and interface vtables to the constant initializer of class cd // 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(); FuncDeclaration* fd = dsym->isFuncDeclaration();
assert(fd); 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)) if (fd->isAbstract() || (cd->isAbstract() && !fd->fbody))
{ {
sinits[k] = getNullPtr(getVoidPtrType()); sinits[k] = getNullPtr(getVoidPtrType());

View file

@ -18,7 +18,6 @@
#include "ir/irstruct.h" #include "ir/irstruct.h"
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
void addZeros(std::vector<llvm::Constant*>& inits, unsigned pos, unsigned offset); // defined in irstruct.cpp
// pair of var and its init // pair of var and its init
typedef std::pair<VarDeclaration*,Initializer*> VarInitPair; typedef std::pair<VarDeclaration*,Initializer*> VarInitPair;

View file

@ -2277,8 +2277,6 @@ LLConstant* ArrayLiteralExp::toConstElem(IRState* p)
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
void addZeros(std::vector<llvm::Value*>& inits, unsigned pos, unsigned offset);
DValue* StructLiteralExp::toElem(IRState* p) DValue* StructLiteralExp::toElem(IRState* p)
{ {
Logger::print("StructLiteralExp::toElem: %s | %s\n", toChars(), type->toChars()); Logger::print("StructLiteralExp::toElem: %s | %s\n", toChars(), type->toChars());
@ -2362,8 +2360,6 @@ DValue* StructLiteralExp::toElem(IRState* p)
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
void addZeros(std::vector<llvm::Constant*>& inits, unsigned pos, unsigned offset);
LLConstant* StructLiteralExp::toConstElem(IRState* p) LLConstant* StructLiteralExp::toConstElem(IRState* p)
{ {
Logger::print("StructLiteralExp::toConstElem: %s | %s\n", toChars(), type->toChars()); Logger::print("StructLiteralExp::toConstElem: %s | %s\n", toChars(), type->toChars());

View file

@ -120,8 +120,6 @@ void IrStruct::popAnon()
////////////////////////////////////////// //////////////////////////////////////////
void addZeros(std::vector<const llvm::Type*>& inits, size_t pos, size_t offset);
void IrStruct::addVar(VarDeclaration * var) void IrStruct::addVar(VarDeclaration * var)
{ {
TypeVector* tvec = &types; TypeVector* tvec = &types;

View file

@ -8,6 +8,10 @@
struct IrInterface; struct IrInterface;
void addZeros(std::vector<const llvm::Type*>& inits, size_t pos, size_t offset);
void addZeros(std::vector<llvm::Constant*>& inits, size_t pos, size_t offset);
void addZeros(std::vector<llvm::Value*>& inits, size_t pos, size_t offset);
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////