This fixes a bug where clang would emit instructions to reclaim a value
that's going to be __bridge-casted to CF.
rdar://problem/
34687542
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314370
91177308-0d34-0410-b5e6-
96231b3b80d8
// 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();
// 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;
+}