[PATCH] Refactor: Simplify boolean conditional return statements in lib/ARCMigrate

Alexander Kornienko alexfh at google.com
Tue May 26 07:00:47 PDT 2015


================
Comment at: lib/ARCMigrate/TransRetainReleaseDealloc.cpp:177
@@ -176,3 +176,3 @@
   bool isCommonUnusedAutorelease(ObjCMessageExpr *E) {
     if (isPlusOneAssignBeforeOrAfterAutorelease(E))
       return true;
----------------
I'd replace both ifs with `return isPlusOneAssignBeforeOrAfterAutorelease(E) || isReturnedAfterAutorelease(E);`.

================
Comment at: lib/ARCMigrate/TransRetainReleaseDealloc.cpp:226
@@ -227,3 +225,3 @@
     if (BinaryOperator *Bop = dyn_cast<BinaryOperator>(S)) {
       if (RefD != getReferencedDecl(Bop->getLHS()))
         return false;
----------------
I'd replace both ifs with `return RefD == getReferencedDecl(Bop->getLHS()) && isPlusOneAssign(Bop);`

http://reviews.llvm.org/D10009

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list