From 02caaff23e21c0d0264cdf6a1858bee059a973f9 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Sat, 21 Jun 2008 00:00:56 +0200 Subject: [PATCH] [svn r303] Start a new basicblock behind a HaltExp to prevent compiler errors. --- gen/toir.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gen/toir.cpp b/gen/toir.cpp index 163aaabb39..f4414de12a 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -2238,6 +2238,14 @@ DValue* HaltExp::toElem(IRState* p) #endif new llvm::UnreachableInst(p->scopebb()); + + // this terminated the basicblock, start a new one + // this is sensible, since someone might goto behind the assert + // and prevents compiler errors if a terminator follows the assert + llvm::BasicBlock* oldend = gIR->scopeend(); + llvm::BasicBlock* bb = llvm::BasicBlock::Create("afterhalt", p->topfunc(), oldend); + p->scope() = IRScope(bb,oldend); + return 0; }