// pr10411
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135638
91177308-0d34-0410-b5e6-
96231b3b80d8
StmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc,
Expr *Throw) {
if (Throw) {
+ Throw = MaybeCreateExprWithCleanups(Throw);
ExprResult Result = DefaultLvalueConversion(Throw);
if (Result.isInvalid())
return StmtError();
if (!AtCatchParent)
return StmtError(Diag(AtLoc, diag::error_rethrow_used_outside_catch));
}
-
+
return BuildObjCAtThrowStmt(AtLoc, Throw);
}
--- /dev/null
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fobjc-nonfragile-abi -fobjc-exceptions -o - %s | FileCheck %s
+// $CLANG -cc1 -fobjc-arc -fobjc-nonfragile-abi -fobjc-exceptions
+// pr10411
+
+@interface NSException
++ (id)exception;
+@end
+
+void test()
+{
+ @throw [NSException exception];
+}
+
+// CHECK: objc_retainAutoreleasedReturnValue
+// CHECK: call void @objc_release
+// CHECK: call void @objc_exception_throw