[svn r349] Fixed problems with static arrays of void as well as a static arrays with zero length.

Fixed issues with DMD generated assert statements when using class invariants, generally due to incomplete ASTs.
Removed some dead code.
Added a few comments.
This commit is contained in:
Tomas Lindquist Olsen
2008-07-11 00:17:00 +02:00
parent bace4dd0e7
commit 521de1a47e
8 changed files with 56 additions and 89 deletions

View File

@@ -89,6 +89,7 @@ const LLType* DtoType(Type* t)
// pointers
case Tpointer:
// getPtrToType checks for void itself
return getPtrToType(DtoType(t->next));
// arrays
@@ -152,6 +153,7 @@ const LLType* DtoType(Type* t)
case Taarray:
{
TypeAArray* taa = (TypeAArray*)t;
// aa key/val can't be void
return getPtrToType(LLStructType::get(DtoType(taa->key), DtoType(taa->next), 0));
}
@@ -164,6 +166,16 @@ const LLType* DtoType(Type* t)
//////////////////////////////////////////////////////////////////////////////////////////
const LLType* DtoTypeNotVoid(Type* t)
{
const LLType* lt = DtoType(t);
if (lt == LLType::VoidTy)
return LLType::Int8Ty;
return lt;
}
//////////////////////////////////////////////////////////////////////////////////////////
const LLStructType* DtoDelegateType(Type* t)
{
const LLType* i8ptr = getVoidPtrType();
@@ -499,7 +511,7 @@ llvm::ConstantFP* DtoConstFP(Type* t, long double value)
LLConstant* DtoConstString(const char* str)
{
std::string s(str);
std::string s(str?str:"");
LLConstant* init = llvm::ConstantArray::get(s, true);
llvm::GlobalVariable* gvar = new llvm::GlobalVariable(
init->getType(), true,llvm::GlobalValue::InternalLinkage, init, ".str", gIR->module);