Emit trap for assert(0) in release mode.

This commit is contained in:
David Nadlinger
2013-09-15 23:44:13 +02:00
parent 0a8e1f78b7
commit 945f4882c2

View File

@@ -2446,15 +2446,8 @@ DValue* HaltExp::toElem(IRState* p)
Logger::print("HaltExp::toElem: %s\n", toChars());
LOG_SCOPE;
// FIXME: DMD inserts a trap here... we probably should as well !?!
#if 1
DtoAssert(p->func()->decl->getModule(), loc, NULL);
#else
// call the new (?) trap intrinsic
p->ir->CreateCall(GET_INTRINSIC_DECL(trap),"");
new llvm::UnreachableInst(p->scopebb());
#endif
p->ir->CreateCall(GET_INTRINSIC_DECL(trap), "");
p->ir->CreateUnreachable();
// this terminated the basicblock, start a new one
// this is sensible, since someone might goto behind the assert