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

@@ -165,6 +165,21 @@ LLCallSite IRState::CreateCallOrInvoke4(LLValue* Callee, LLValue* Arg1, LLValue*
return CreateCallOrInvoke(Callee, args, Name);
}
bool IRState::emitArrayBoundsChecks()
{
int p = global.params.useArrayBounds;
// 0 or 2 are absolute decisions.
if (p != 1) return p != 0;
// Safe functions only.
if (functions.empty()) return false;
Type* t = func()->decl->type;
return t->ty == Tfunction && ((TypeFunction*)t)->trust == TRUSTsafe;
}
//////////////////////////////////////////////////////////////////////////////////////////
IRBuilder<>* IRBuilderHelper::operator->()