Make -release only disable bounds checking in non-@safe code.

This commit is contained in:
David Nadlinger
2013-06-17 13:07:33 +02:00
parent 1215ffacd3
commit 235bb94878
9 changed files with 42 additions and 17 deletions

View File

@@ -80,7 +80,7 @@ DValue* DtoAAIndex(Loc& loc, Type* type, DValue* aa, DValue* key, bool lvalue)
// Only check bounds for rvalues ('aa[key]').
// Lvalue use ('aa[key] = value') auto-adds an element.
if (!lvalue && global.params.useArrayBounds) {
if (!lvalue && gIR->emitArrayBoundsChecks()) {
llvm::BasicBlock* oldend = gIR->scopeend();
llvm::BasicBlock* failbb = llvm::BasicBlock::Create(gIR->context(), "aaboundscheckfail", gIR->topfunc(), oldend);
llvm::BasicBlock* okbb = llvm::BasicBlock::Create(gIR->context(), "aaboundsok", gIR->topfunc(), oldend);