mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-08-16 19:30:14 +02:00
[svn r304] Fix associative array literals by always reserving a zero inited temporary for them.
This commit is contained in:
15
gen/toir.cpp
15
gen/toir.cpp
@@ -2815,17 +2815,12 @@ DValue* AssocArrayLiteralExp::toElem(IRState* p)
|
|||||||
|
|
||||||
Type* aatype = DtoDType(type);
|
Type* aatype = DtoDType(type);
|
||||||
Type* vtype = aatype->next;
|
Type* vtype = aatype->next;
|
||||||
|
const LLType* aalltype = DtoType(type);
|
||||||
|
|
||||||
DValue* aa;
|
// it should be possible to avoid the temporary in some cases
|
||||||
if (p->topexp() && p->topexp()->e2 == this)
|
LLValue* tmp = new llvm::AllocaInst(aalltype,"aaliteral",p->topallocapoint());
|
||||||
{
|
DValue* aa = new DVarValue(type, tmp, true);
|
||||||
aa = p->topexp()->v;
|
DtoStore(LLConstant::getNullValue(aalltype), tmp);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LLValue* tmp = new llvm::AllocaInst(DtoType(type),"aaliteral",p->topallocapoint());
|
|
||||||
aa = new DVarValue(type, tmp, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
const size_t n = keys->dim;
|
const size_t n = keys->dim;
|
||||||
for (size_t i=0; i<n; ++i)
|
for (size_t i=0; i<n; ++i)
|
||||||
|
|||||||
Reference in New Issue
Block a user