]> granicus.if.org Git - clang/commitdiff
Bind cleanups after doing l2r conversion on the operand of a
authorJohn McCall <rjmccall@apple.com>
Tue, 8 May 2012 21:41:25 +0000 (21:41 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 8 May 2012 21:41:25 +0000 (21:41 +0000)
@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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156425 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaStmt.cpp
test/SemaObjC/arc-property.m

index 77cc642b5ec5b13482a8b49fde5a7f9711c82b0b..2e1cc7c60057555a4f2b04731c5367e73063a65d 100644 (file)
@@ -2677,15 +2677,13 @@ Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try,
                                      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() &&
index 2599fb9848f22cc8a9bbee692acd50176b27c7e0..41d8e872396155805bf00324bf3b2452d663c37c 100644 (file)
@@ -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 {
 @implementation Test2
 @synthesize test2;
 @end
+
+// rdar://problem/11144407
+@interface Test3
+@property (strong) id exception;
+@end
+void test3(Test3 *t3) {
+  @throw t3.exception;
+}