summaryrefslogtreecommitdiffstats
path: root/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-07-07 06:58:02 +0000
committerJohn McCall <rjmccall@apple.com>2011-07-07 06:58:02 +0000
commit4db5c3c83a22268ff0eeaa6ca7fd500668533487 (patch)
tree64decea6f573f5fce3cc231a02c8520270bc922c /clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
parent54677c15f351d9caf35b88853d6bb54f055b27f7 (diff)
downloadbcm5719-llvm-4db5c3c83a22268ff0eeaa6ca7fd500668533487.tar.gz
bcm5719-llvm-4db5c3c83a22268ff0eeaa6ca7fd500668533487.zip
In ARC, reclaim all return values of retainable type, not just those
where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
Diffstat (limited to 'clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp')
-rw-r--r--clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp b/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
index c177363b18e..fe80a43a6ae 100644
--- a/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
+++ b/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
@@ -116,11 +116,16 @@ private:
return true;
}
- if (ParenExpr *parenE = dyn_cast_or_null<ParenExpr>(StmtMap->getParent(E)))
+ Stmt *parent = StmtMap->getParent(E);
+
+ if (ImplicitCastExpr *castE = dyn_cast_or_null<ImplicitCastExpr>(parent))
+ return tryRemoving(castE);
+
+ if (ParenExpr *parenE = dyn_cast_or_null<ParenExpr>(parent))
return tryRemoving(parenE);
if (BinaryOperator *
- bopE = dyn_cast_or_null<BinaryOperator>(StmtMap->getParent(E))) {
+ bopE = dyn_cast_or_null<BinaryOperator>(parent)) {
if (bopE->getOpcode() == BO_Comma && bopE->getLHS() == E &&
isRemovable(bopE)) {
Pass.TA.replace(bopE->getSourceRange(), bopE->getRHS()->getSourceRange());
OpenPOWER on IntegriCloud