Mercurial > projects > ldc
diff gen/tollvm.cpp @ 328:7086a84ab3d6 trunk
[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.
author | lindquist |
---|---|
date | Fri, 11 Jul 2008 00:17:00 +0200 |
parents | 0d52412d5b1a |
children | e20ce6d8d374 |
line wrap: on
line diff
--- a/gen/tollvm.cpp Thu Jul 10 22:00:27 2008 +0200 +++ b/gen/tollvm.cpp Fri Jul 11 00:17:00 2008 +0200 @@ -89,6 +89,7 @@ // pointers case Tpointer: + // getPtrToType checks for void itself return getPtrToType(DtoType(t->next)); // arrays @@ -152,6 +153,7 @@ 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* 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 @@ 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);