mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-30 23:20:40 +03: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:
parent
bace4dd0e7
commit
521de1a47e
8 changed files with 56 additions and 89 deletions
|
@ -34,21 +34,16 @@ const LLStructType* DtoArrayType(const LLType* t)
|
|||
|
||||
const LLArrayType* DtoStaticArrayType(Type* t)
|
||||
{
|
||||
if (t->ir.type)
|
||||
return isaArray(t->ir.type->get());
|
||||
|
||||
t = t->toBasetype();
|
||||
assert(t->ty == Tsarray);
|
||||
assert(t->next);
|
||||
|
||||
const LLType* at = DtoType(t->next);
|
||||
|
||||
TypeSArray* tsa = (TypeSArray*)t;
|
||||
assert(tsa->dim->type->isintegral());
|
||||
const LLArrayType* arrty = LLArrayType::get(at,tsa->dim->toUInteger());
|
||||
Type* tnext = tsa->next;
|
||||
|
||||
assert(!tsa->ir.type);
|
||||
tsa->ir.type = new LLPATypeHolder(arrty);
|
||||
return arrty;
|
||||
const LLType* elemty = DtoType(tnext);
|
||||
if (elemty == LLType::VoidTy)
|
||||
elemty = LLType::Int8Ty;
|
||||
|
||||
return LLArrayType::get(elemty, tsa->dim->toUInteger());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -974,14 +969,8 @@ DValue* DtoCastArray(DValue* u, Type* to)
|
|||
}
|
||||
else if (totype->ty == Tarray) {
|
||||
Logger::cout() << "to array" << '\n';
|
||||
const LLType* ptrty = DtoType(totype->next);
|
||||
if (ptrty == LLType::VoidTy)
|
||||
ptrty = LLType::Int8Ty;
|
||||
ptrty = getPtrToType(ptrty);
|
||||
|
||||
const LLType* ety = DtoType(fromtype->next);
|
||||
if (ety == LLType::VoidTy)
|
||||
ety = LLType::Int8Ty;
|
||||
const LLType* ptrty = DtoArrayType(totype)->getContainedType(1);
|
||||
const LLType* ety = DtoTypeNotVoid(fromtype->next);
|
||||
|
||||
if (DSliceValue* usl = u->isSlice()) {
|
||||
Logger::println("from slice");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue