aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/CGStmt.cpp3
-rw-r--r--lib/CodeGen/CodeGenFunction.h4
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index f2088f416d..97a7a05768 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -168,11 +168,12 @@ void CodeGenFunction::EmitBranch(llvm::BasicBlock *Target) {
// If the last block was an empty placeholder, remove it now.
// TODO: cache and reuse these.
CurBB->eraseFromParent();
- Builder.ClearInsertionPoint();
} else {
// Otherwise, create a fall-through branch.
Builder.CreateBr(Target);
}
+
+ Builder.ClearInsertionPoint();
}
void CodeGenFunction::EmitDummyBlock() {
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index d482086e1a..b833380e49 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -229,6 +229,10 @@ public:
/// EmitBranch - Emit a branch to the specified basic block from the
/// current insert block, taking care to avoid creation of branches
/// from dummy blocks.
+ ///
+ /// This function clears the current insertion point. The caller
+ /// should follow calls to this function with calls to Emit*Block
+ /// prior to generation new code.
void EmitBranch(llvm::BasicBlock *Block);
/// EmitDummyBlock - Emit a new block which will never be branched