diff options
author | John McCall <rjmccall@apple.com> | 2011-06-22 02:32:12 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-06-22 02:32:12 +0000 |
commit | 6b0feb7ed61dd2578b3a7f3d699b72e22dde66e3 (patch) | |
tree | 600b5094ba328a9bd5a728de023e335df59e728c /clang/lib/CodeGen/CGObjCRuntime.cpp | |
parent | 7b7fece4d48a69e4976a04724621b9635d377ae4 (diff) | |
download | bcm5719-llvm-6b0feb7ed61dd2578b3a7f3d699b72e22dde66e3.tar.gz bcm5719-llvm-6b0feb7ed61dd2578b3a7f3d699b72e22dde66e3.zip |
Emit @finally blocks completely lazily instead of forcing their
existence by always threading an edge from the catchall. Not doing
this was previously causing a crash in the very extreme case where
neither the normal cleanup nor the EH catchall was actually reachable:
we would delete the catchall entry block, which would cause us to
delete the entry block of the finally cleanup as well because the
cleanup logic would merge the blocks, which in turn triggered an assert
because later blocks in the finally would still be using values from the
entry. Laziness turns out to be the most elegant solution to the problem.
llvm-svn: 133601
Diffstat (limited to 'clang/lib/CodeGen/CGObjCRuntime.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGObjCRuntime.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGObjCRuntime.cpp b/clang/lib/CodeGen/CGObjCRuntime.cpp index a2c3ea591e4..6ce1cb94353 100644 --- a/clang/lib/CodeGen/CGObjCRuntime.cpp +++ b/clang/lib/CodeGen/CGObjCRuntime.cpp @@ -175,10 +175,8 @@ void CGObjCRuntime::EmitTryCatchStmt(CodeGenFunction &CGF, CodeGenFunction::FinallyInfo FinallyInfo; if (const ObjCAtFinallyStmt *Finally = S.getFinallyStmt()) - FinallyInfo = CGF.EnterFinallyBlock(Finally->getFinallyBody(), - beginCatchFn, - endCatchFn, - exceptionRethrowFn); + FinallyInfo.enter(CGF, Finally->getFinallyBody(), + beginCatchFn, endCatchFn, exceptionRethrowFn); llvm::SmallVector<CatchHandler, 8> Handlers; @@ -266,9 +264,9 @@ void CGObjCRuntime::EmitTryCatchStmt(CodeGenFunction &CGF, // Go back to the try-statement fallthrough. CGF.Builder.restoreIP(SavedIP); - // Pop out of the normal cleanup on the finally. + // Pop out of the finally. if (S.getFinallyStmt()) - CGF.ExitFinallyBlock(FinallyInfo); + FinallyInfo.exit(CGF); if (Cont.isValid()) CGF.EmitBlock(Cont.getBlock()); |