diff options
author | John McCall <rjmccall@apple.com> | 2012-05-08 21:41:25 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2012-05-08 21:41:25 +0000 |
commit | 0bd3e404af219ef5baabe2b7b896e9ef1feca0ed (patch) | |
tree | 7f6de2325753a6b184a2f3cb2dc6d49de745fed6 | |
parent | b9c53daa5584fe0652e077e8e9150058ceb81525 (diff) | |
download | bcm5719-llvm-0bd3e404af219ef5baabe2b7b896e9ef1feca0ed.tar.gz bcm5719-llvm-0bd3e404af219ef5baabe2b7b896e9ef1feca0ed.zip |
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.
llvm-svn: 156425
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 6 | ||||
-rw-r--r-- | clang/test/SemaObjC/arc-property.m | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 77cc642b5ec..2e1cc7c6005 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -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() && diff --git a/clang/test/SemaObjC/arc-property.m b/clang/test/SemaObjC/arc-property.m index 2599fb9848f..41d8e872396 100644 --- a/clang/test/SemaObjC/arc-property.m +++ b/clang/test/SemaObjC/arc-property.m @@ -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 +@interface Test3 +@property (strong) id exception; +@end +void test3(Test3 *t3) { + @throw t3.exception; +} |