]> granicus.if.org Git - clang/commitdiff
Change EmitBranch to always clear the insert point to clarify irgen
authorDaniel Dunbar <daniel@zuster.org>
Tue, 11 Nov 2008 22:06:59 +0000 (22:06 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 11 Nov 2008 22:06:59 +0000 (22:06 +0000)
invariants.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59085 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGStmt.cpp
lib/CodeGen/CodeGenFunction.h

index f2088f416d5f585cfd5b3243c56de2673e67de3b..97a7a05768766689dfc3cf5ba8f842e7f500eff5 100644 (file)
@@ -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() {
index d482086e1a17969552d85a61d314941d3f42b01e..b833380e49afe7b52ffa29c193c3aead97981ce4 100644 (file)
@@ -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