forked from OSchip/llvm-project
Look through parentheses.
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 llvm-svn: 314370
This commit is contained in:
parent
d122381288
commit
fa1930c506
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue