[cfe-commits] r131215 - /cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp

John McCall rjmccall at apple.com
Wed May 11 18:00:15 PDT 2011


Author: rjmccall
Date: Wed May 11 20:00:15 2011
New Revision: 131215

URL: http://llvm.org/viewvc/llvm-project?rev=131215&view=rev
Log:
Make this code more resilient against catch variables which need cleanups.


Modified:
    cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp?rev=131215&r1=131214&r2=131215&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp Wed May 11 20:00:15 2011
@@ -233,6 +233,8 @@
       cast<llvm::CallInst>(Exn)->setDoesNotThrow();
     }
 
+    CodeGenFunction::RunCleanupsScope cleanups(CGF);
+
     if (endCatchFn) {
       // Add a cleanup to leave the catch.
       bool EndCatchMightThrow = (Handler.Variable == 0);
@@ -255,9 +257,8 @@
     CGF.EmitStmt(Handler.Body);
     CGF.ObjCEHValueStack.pop_back();
 
-    // Leave the earlier cleanup.
-    if (endCatchFn) 
-      CGF.PopCleanupBlock();
+    // Leave any cleanups associated with the catch.
+    cleanups.ForceCleanup();
 
     CGF.EmitBranchThroughCleanup(Cont);
   }  





More information about the cfe-commits mailing list