[cfe-commits] r101998 - in /cfe/trunk/lib/CodeGen: CGStmt.cpp CodeGenFunction.h
John McCall
rjmccall at apple.com
Wed Apr 21 04:18:06 PDT 2010
Author: rjmccall
Date: Wed Apr 21 06:18:06 2010
New Revision: 101998
URL: http://llvm.org/viewvc/llvm-project?rev=101998&view=rev
Log:
I failed to notice that my last patch wasn't doing as much as it could
because EmitBranch actually clears the insert point. This version
actually accomplishes what I initially wanted.
Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=101998&r1=101997&r2=101998&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Wed Apr 21 06:18:06 2010
@@ -205,6 +205,8 @@
}
void CodeGenFunction::EmitBlock(llvm::BasicBlock *BB, bool IsFinished) {
+ llvm::BasicBlock *CurBB = Builder.GetInsertBlock();
+
// Fall out of the current block (if necessary).
EmitBranch(BB);
@@ -227,8 +229,8 @@
// Place the block after the current block, if possible, or else at
// the end of the function.
- if (Builder.GetInsertBlock())
- CurFn->getBasicBlockList().insertAfter(Builder.GetInsertBlock(), BB);
+ if (CurBB && CurBB->getParent())
+ CurFn->getBasicBlockList().insertAfter(CurBB, BB);
else
CurFn->getBasicBlockList().push_back(BB);
Builder.SetInsertPoint(BB);
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=101998&r1=101997&r2=101998&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Apr 21 06:18:06 2010
@@ -184,7 +184,8 @@
public:
DelayedCleanupBlock(CodeGenFunction &cgf, bool ehonly = false)
: CGF(cgf), CurBB(CGF.Builder.GetInsertBlock()),
- CleanupEntryBB(CGF.createBasicBlock("cleanup")), CleanupExitBB(0),
+ CleanupEntryBB(CGF.createBasicBlock("cleanup")),
+ CleanupExitBB(0),
CurInvokeDest(CGF.getInvokeDest()),
EHOnly(ehonly) {
CGF.Builder.SetInsertPoint(CleanupEntryBB);
More information about the cfe-commits
mailing list