CGF.Builder.CreateCall(ObjCTypes.ExceptionThrowFn, ExceptionAsObject);
CGF.Builder.CreateUnreachable();
- CGF.EmitBlock(CGF.createBasicBlock("bb"));
+ CGF.EmitDummyBlock();
}
void CodeGenFunction::EmitJumpThroughFinally(ObjCEHEntry *E,
Builder.SetInsertPoint(BB);
}
+void CodeGenFunction::EmitDummyBlock() {
+ EmitBlock(createBasicBlock());
+}
+
void CodeGenFunction::EmitLabel(const LabelStmt &S) {
llvm::BasicBlock *NextBB = getBasicBlockForLabel(&S);
EmitBlock(NextBB);
// Emit a block after the branch so that dead code after a goto has some place
// to go.
- Builder.SetInsertPoint(createBasicBlock("", CurFn));
+ EmitDummyBlock();
}
void CodeGenFunction::EmitIndirectGotoStmt(const IndirectGotoStmt &S) {
// Emit a block after the branch so that dead code after a goto has some place
// to go.
- Builder.SetInsertPoint(createBasicBlock("", CurFn));
+ EmitDummyBlock();
}
void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
// Emit a block after the branch so that dead code after a return has some
// place to go.
- EmitBlock(createBasicBlock());
+ EmitDummyBlock();
}
/// EmitReturnStmt - Note that due to GCC extensions, this can have an operand
// Emit a block after the branch so that dead code after a return has some
// place to go.
- EmitBlock(createBasicBlock());
+ EmitDummyBlock();
}
void CodeGenFunction::EmitDeclStmt(const DeclStmt &S) {
llvm::BasicBlock *Block = BreakContinueStack.back().BreakBlock;
Builder.CreateBr(Block);
- EmitBlock(createBasicBlock());
+ EmitDummyBlock();
}
void CodeGenFunction::EmitContinueStmt() {
llvm::BasicBlock *Block = BreakContinueStack.back().ContinueBlock;
Builder.CreateBr(Block);
- EmitBlock(createBasicBlock());
+ EmitDummyBlock();
}
/// EmitCaseStmtRange - If case statement range is not too big then
llvm::BasicBlock *getBasicBlockForLabel(const LabelStmt *S);
void EmitBlock(llvm::BasicBlock *BB);
+
+ /// EmitDummyBlock - Emit a new block which will never be branched
+ /// to. This is used to satisfy the invariant that codegen always
+ /// has an active unterminated block to dump code into.
+ void EmitDummyBlock();
/// ErrorUnsupported - Print out an error that codegen doesn't support the
/// specified stmt yet.