Add CodeGenFunction::EmitDummyBlock for marking places where we make
"dummy" blocks (blocks just used to make sure we have a place to dump
code to).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59022 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index 9d6a79b..82c3920 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -167,6 +167,10 @@
Builder.SetInsertPoint(BB);
}
+void CodeGenFunction::EmitDummyBlock() {
+ EmitBlock(createBasicBlock());
+}
+
void CodeGenFunction::EmitLabel(const LabelStmt &S) {
llvm::BasicBlock *NextBB = getBasicBlockForLabel(&S);
EmitBlock(NextBB);
@@ -189,7 +193,7 @@
// 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) {
@@ -210,7 +214,7 @@
// 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) {
@@ -433,7 +437,7 @@
// 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
@@ -473,7 +477,7 @@
// 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) {
@@ -487,7 +491,7 @@
llvm::BasicBlock *Block = BreakContinueStack.back().BreakBlock;
Builder.CreateBr(Block);
- EmitBlock(createBasicBlock());
+ EmitDummyBlock();
}
void CodeGenFunction::EmitContinueStmt() {
@@ -495,7 +499,7 @@
llvm::BasicBlock *Block = BreakContinueStack.back().ContinueBlock;
Builder.CreateBr(Block);
- EmitBlock(createBasicBlock());
+ EmitDummyBlock();
}
/// EmitCaseStmtRange - If case statement range is not too big then