changeset 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
files gen/classes.cpp gen/structs.cpp gen/toir.cpp ir/irstruct.cpp ir/irstruct.h
diffstat 5 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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<llvm::Constant*>& 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());
--- 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<llvm::Constant*>& inits, unsigned pos, unsigned offset); // defined in irstruct.cpp
 
 // pair of var and its init
 typedef std::pair<VarDeclaration*,Initializer*> VarInitPair;
--- 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<llvm::Value*>& 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<llvm::Constant*>& inits, unsigned pos, unsigned offset);
-
 LLConstant* StructLiteralExp::toConstElem(IRState* p)
 {
     Logger::print("StructLiteralExp::toConstElem: %s | %s\n", toChars(), type->toChars());
--- 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<const llvm::Type*>& inits, size_t pos, size_t offset);
-
 void IrStruct::addVar(VarDeclaration * var)
 {
     TypeVector* tvec = &types;
--- 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<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);
+
 //////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////