diff options
Diffstat (limited to 'lib/CodeGen/CGException.cpp')
-rw-r--r-- | lib/CodeGen/CGException.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp index 99105e165f..746f68daee 100644 --- a/lib/CodeGen/CGException.cpp +++ b/lib/CodeGen/CGException.cpp @@ -1326,6 +1326,12 @@ namespace { CGF.EHStack.pushCleanup<CallEndCatchForFinally>(NormalAndEHCleanup, ForEHVar, EndCatchFn); + // Save the current cleanup destination in case there are + // cleanups in the finally block. + llvm::Value *SavedCleanupDest = + CGF.Builder.CreateLoad(CGF.getNormalCleanupDestSlot(), + "cleanup.dest.saved"); + // Emit the finally block. CGF.EmitStmt(Body); @@ -1349,6 +1355,10 @@ namespace { CGF.Builder.CreateUnreachable(); CGF.EmitBlock(ContBB); + + // Restore the cleanup destination. + CGF.Builder.CreateStore(SavedCleanupDest, + CGF.getNormalCleanupDestSlot()); } // Leave the end-catch cleanup. As an optimization, pretend that |