mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-06-08 17:54:10 +02:00
[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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user