diff options
author | dim <dim@FreeBSD.org> | 2015-12-30 13:34:49 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-12-30 13:34:49 +0000 |
commit | 63b24cc778504ffd19e4c30a730e574c346312ee (patch) | |
tree | 28726ef2038e86121e353aabf52297b35a48efa2 /contrib/llvm/tools/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp | |
parent | 9b5bf5c4f53d65d6a48722d7410ed7cb15f5ba3a (diff) | |
parent | 3176e97f130184ece0e1a21352c8124cc83ff24a (diff) | |
download | FreeBSD-src-63b24cc778504ffd19e4c30a730e574c346312ee.zip FreeBSD-src-63b24cc778504ffd19e4c30a730e574c346312ee.tar.gz |
Update clang to trunk r256633.
Diffstat (limited to 'contrib/llvm/tools/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/contrib/llvm/tools/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp b/contrib/llvm/tools/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp index 7db1a1c..f81133f 100644 --- a/contrib/llvm/tools/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp +++ b/contrib/llvm/tools/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp @@ -150,11 +150,8 @@ public: return true; } - if (!hasSideEffects(rec, Pass.Ctx)) { - if (tryRemoving(RecContainer)) - return true; - } - Pass.TA.replace(RecContainer->getSourceRange(), RecRange); + if (hasSideEffects(rec, Pass.Ctx) || !tryRemoving(RecContainer)) + Pass.TA.replace(RecContainer->getSourceRange(), RecRange); return true; } @@ -174,11 +171,8 @@ private: /// return var; /// bool isCommonUnusedAutorelease(ObjCMessageExpr *E) { - if (isPlusOneAssignBeforeOrAfterAutorelease(E)) - return true; - if (isReturnedAfterAutorelease(E)) - return true; - return false; + return isPlusOneAssignBeforeOrAfterAutorelease(E) || + isReturnedAfterAutorelease(E); } bool isReturnedAfterAutorelease(ObjCMessageExpr *E) { @@ -225,11 +219,7 @@ private: // Check for "RefD = [+1 retained object];". if (BinaryOperator *Bop = dyn_cast<BinaryOperator>(S)) { - if (RefD != getReferencedDecl(Bop->getLHS())) - return false; - if (isPlusOneAssign(Bop)) - return true; - return false; + return (RefD == getReferencedDecl(Bop->getLHS())) && isPlusOneAssign(Bop); } if (DeclStmt *DS = dyn_cast<DeclStmt>(S)) { @@ -359,16 +349,16 @@ private: return; Stmt::child_range StmtExprChild = StmtE->children(); - if (!StmtExprChild) + if (StmtExprChild.begin() == StmtExprChild.end()) return; - CompoundStmt *CompS = dyn_cast_or_null<CompoundStmt>(*StmtExprChild); + auto *CompS = dyn_cast_or_null<CompoundStmt>(*StmtExprChild.begin()); if (!CompS) return; Stmt::child_range CompStmtChild = CompS->children(); - if (!CompStmtChild) + if (CompStmtChild.begin() == CompStmtChild.end()) return; - DeclStmt *DeclS = dyn_cast_or_null<DeclStmt>(*CompStmtChild); + auto *DeclS = dyn_cast_or_null<DeclStmt>(*CompStmtChild.begin()); if (!DeclS) return; if (!DeclS->isSingleDecl()) |