[cfe-commits] r156425 - in /cfe/trunk: lib/Sema/SemaStmt.cpp test/SemaObjC/arc-property.m

John McCall rjmccall at apple.com
Tue May 8 14:41:25 PDT 2012


Author: rjmccall
Date: Tue May  8 16:41:25 2012
New Revision: 156425

URL: http://llvm.org/viewvc/llvm-project?rev=156425&view=rev
Log:
Bind cleanups after doing l2r conversion on the operand of a
@throw expression;  l2r conversion can introduce new cleanups
in certain cases, like when the expression is an ObjC property
reference of retainable type in ARC.

Modified:
    cfe/trunk/lib/Sema/SemaStmt.cpp
    cfe/trunk/test/SemaObjC/arc-property.m

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=156425&r1=156424&r2=156425&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Tue May  8 16:41:25 2012
@@ -2677,15 +2677,13 @@
                                      Finally));
 }
 
-StmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc,
-                                                  Expr *Throw) {
+StmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw) {
   if (Throw) {
-    Throw = MaybeCreateExprWithCleanups(Throw);
     ExprResult Result = DefaultLvalueConversion(Throw);
     if (Result.isInvalid())
       return StmtError();
 
-    Throw = Result.take();
+    Throw = MaybeCreateExprWithCleanups(Result.take());
     QualType ThrowType = Throw->getType();
     // Make sure the expression type is an ObjC pointer or "void *".
     if (!ThrowType->isDependentType() &&

Modified: cfe/trunk/test/SemaObjC/arc-property.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-property.m?rev=156425&r1=156424&r2=156425&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-property.m (original)
+++ cfe/trunk/test/SemaObjC/arc-property.m Tue May  8 16:41:25 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -fobjc-exceptions -verify -Wno-objc-root-class %s
 // rdar://9309489
 
 @interface MyClass {
@@ -55,3 +55,11 @@
 @implementation Test2
 @synthesize test2;
 @end
+
+// rdar://problem/11144407
+ at interface Test3
+ at property (strong) id exception;
+ at end
+void test3(Test3 *t3) {
+  @throw t3.exception;
+}





More information about the cfe-commits mailing list