[cfe-commits] r142467 - in /cfe/trunk: lib/CodeGen/CGObjCRuntime.cpp test/CodeGenObjC/catch-lexical-block.m

Eric Christopher echristo at apple.com
Tue Oct 18 17:44:01 PDT 2011


Author: echristo
Date: Tue Oct 18 19:44:01 2011
New Revision: 142467

URL: http://llvm.org/viewvc/llvm-project?rev=142467&view=rev
Log:
Add block information for ObjC @catch blocks.

Fixes rdar://10282889

Added:
    cfe/trunk/test/CodeGenObjC/catch-lexical-block.m
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=142467&r1=142466&r2=142467&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp Tue Oct 18 19:44:01 2011
@@ -229,7 +229,7 @@
       cast<llvm::CallInst>(Exn)->setDoesNotThrow();
     }
 
-    CodeGenFunction::RunCleanupsScope cleanups(CGF);
+    CodeGenFunction::LexicalScope cleanups(CGF, Handler.Body->getSourceRange());
 
     if (endCatchFn) {
       // Add a cleanup to leave the catch.

Added: cfe/trunk/test/CodeGenObjC/catch-lexical-block.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/catch-lexical-block.m?rev=142467&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/catch-lexical-block.m (added)
+++ cfe/trunk/test/CodeGenObjC/catch-lexical-block.m Tue Oct 18 19:44:01 2011
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -g -fobjc-exceptions -emit-llvm %s -o - | FileCheck %s
+ at interface Foo @end
+void f0() {
+  @try {
+    @throw @"a";
+  } @catch(Foo *e) {
+  }
+}
+
+// We should have 4 lexical blocks here at the moment, including one
+// for the catch block.
+// CHECK: lexical_block
+// CHECK: lexical_block
+// CHECK: lexical_block
+// CHECK: auto_variable
+// CHECK: lexical_block





More information about the cfe-commits mailing list