diff options
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/arc-bridged-cast.m | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 83ef799392a..93c98235654 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -4322,7 +4322,7 @@ static Expr *maybeUndoReclaimObject(Expr *e) { // problems here. To catch them all, we'd need to rebuild arbitrary // value-propagating subexpressions --- we can't reliably rebuild // in-place because of expression sharing. - if (ImplicitCastExpr *ice = dyn_cast<ImplicitCastExpr>(e)) + if (auto *ice = dyn_cast<ImplicitCastExpr>(e->IgnoreParens())) if (ice->getCastKind() == CK_ARCReclaimReturnedObject) return ice->getSubExpr(); diff --git a/clang/test/CodeGenObjC/arc-bridged-cast.m b/clang/test/CodeGenObjC/arc-bridged-cast.m index 97a45c5a2f1..93f5d7ccaa3 100644 --- a/clang/test/CodeGenObjC/arc-bridged-cast.m +++ b/clang/test/CodeGenObjC/arc-bridged-cast.m @@ -97,3 +97,10 @@ void bridge_of_cf(int *i) { // CHECK-NEXT: ret void } +// CHECK-LABEL: define %struct.__CFString* @bridge_of_paren_expr() +CFStringRef bridge_of_paren_expr() { + // CHECK-NOT: call i8* @objc_retainAutoreleasedReturnValue( + // CHECK-NOT: call void @objc_release( + CFStringRef r = (__bridge CFStringRef)(CreateNSString()); + return r; +} |