From 945f4882c2b42fc0fe60e65f93cf939c331de238 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sun, 15 Sep 2013 23:44:13 +0200 Subject: [PATCH] Emit trap for assert(0) in release mode. --- gen/toir.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/gen/toir.cpp b/gen/toir.cpp index 01546ff9..35ac9b3f 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -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