mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-06 20:33:12 +01:00
[svn r113] Added initial support for associative arrays (AAs).
Fixed some problems with the string runtime support functions. Fixed initialization of array of structs. Fixed slice assignment where LHS is slice but RHS is dynamic array. Fixed problems with result of assignment expressions. Fixed foreach problems with key type mismatches.
This commit is contained in:
@@ -128,8 +128,8 @@ void ExpStatement::toIR(IRState* p)
|
||||
Logger::println("ExpStatement::toIR(%d): %s", esi++, toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// if (global.params.symdebug)
|
||||
// DtoDwarfStopPoint(loc.linnum);
|
||||
if (global.params.symdebug)
|
||||
DtoDwarfStopPoint(loc.linnum);
|
||||
|
||||
if (exp != 0) {
|
||||
elem* e = exp->toElem(p);
|
||||
@@ -731,6 +731,18 @@ void ForeachStatement::toIR(IRState* p)
|
||||
assert(0 && "aggregate type is not Tarray or Tsarray");
|
||||
}
|
||||
|
||||
if (niters->getType() != keytype)
|
||||
{
|
||||
size_t sz1 = gTargetData->getTypeSize(niters->getType());
|
||||
size_t sz2 = gTargetData->getTypeSize(keytype);
|
||||
if (sz1 < sz2)
|
||||
niters = gIR->ir->CreateZExt(niters, keytype, "foreachtrunckey");
|
||||
else if (sz1 > sz2)
|
||||
niters = gIR->ir->CreateTrunc(niters, keytype, "foreachtrunckey");
|
||||
else
|
||||
niters = gIR->ir->CreateBitCast(niters, keytype, "foreachtrunckey");
|
||||
}
|
||||
|
||||
llvm::Constant* delta = 0;
|
||||
if (op == TOKforeach) {
|
||||
new llvm::StoreInst(zerokey, keyvar, p->scopebb());
|
||||
|
||||
Reference in New Issue
Block a user