Mercurial > projects > ldc
changeset 174:16e676ae5ab4 trunk
[svn r190] Fixed array concatenation for some broken cases.
Added a sanity check for the Dsymbol state set.
author | lindquist |
---|---|
date | Tue, 06 May 2008 18:36:46 +0200 |
parents | db9890b3fb64 |
children | c44e6a711885 |
files | gen/arrays.cpp ir/irsymbol.cpp ir/irtype.cpp |
diffstat | 3 files changed, 9 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/arrays.cpp Tue May 06 07:56:03 2008 +0200 +++ b/gen/arrays.cpp Tue May 06 18:36:46 2008 +0200 @@ -578,20 +578,18 @@ assert(t1->ty == t2->ty); DValue* e1 = exp1->toElem(gIR); - llvm::Value* a = e1->getRVal(); - DValue* e2 = exp2->toElem(gIR); - llvm::Value* b = e2->getRVal(); llvm::Value *len1, *len2, *src1, *src2, *res; - len1 = gIR->ir->CreateLoad(DtoGEPi(a,0,0,"tmp"),"tmp"); - len2 = gIR->ir->CreateLoad(DtoGEPi(b,0,0,"tmp"),"tmp"); + + len1 = DtoArrayLen(e1); + len2 = DtoArrayLen(e2); res = gIR->ir->CreateAdd(len1,len2,"tmp"); llvm::Value* mem = DtoNewDynArray(arr, res, DtoDType(t1->next), false); - src1 = gIR->ir->CreateLoad(DtoGEPi(a,0,1,"tmp"),"tmp"); - src2 = gIR->ir->CreateLoad(DtoGEPi(b,0,1,"tmp"),"tmp"); + src1 = DtoArrayPtr(e1); + src2 = DtoArrayPtr(e2); DtoMemCpy(mem,src1,len1); mem = gIR->ir->CreateGEP(mem,len1,"tmp");
--- a/ir/irsymbol.cpp Tue May 06 07:56:03 2008 +0200 +++ b/ir/irsymbol.cpp Tue May 06 18:36:46 2008 +0200 @@ -14,13 +14,13 @@ IrDsymbol::IrDsymbol() { - list.insert(this); + assert(list.insert(this).second); reset(); } IrDsymbol::IrDsymbol(const IrDsymbol& s) { - list.insert(this); + assert(list.insert(this).second); DModule = s.DModule; irModule = s.irModule; irStruct = s.irStruct;
--- a/ir/irtype.cpp Tue May 06 07:56:03 2008 +0200 +++ b/ir/irtype.cpp Tue May 06 18:36:46 2008 +0200 @@ -13,13 +13,13 @@ IrType::IrType() { - list.insert(this); + assert(list.insert(this).second); reset(); } IrType::IrType(const IrType& s) { - list.insert(this); + assert(list.insert(this).second); type = s.type; vtblType = s.type; }