[PATCH] D10022: Refactor: Simplify boolean conditional return statements in lib/StaticAnalyzer/Core

Anna Zaks via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 28 14:57:55 PDT 2015


zaks.anna added inline comments.

================
Comment at: lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:692-693
@@ -691,4 +691,2 @@
 
   CXXBasePaths Paths(false, false, false);
-  if (RD->lookupInBases(
-          [DeclName](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) {
----------------
LegalizeAdulthood wrote:
> In this case it isn't a simple if-return, if-return, if-return.
I agree that we should keep these as is for better readability and maintainability.

================
Comment at: lib/StaticAnalyzer/Core/SValBuilder.cpp:397
@@ -396,6 +396,3 @@
 
-  if (ToTy != FromTy)
-    return false;
-
-  return true;
+  return ToTy == FromTy;
 }
----------------
Same chaining pattern here. I do not think it should change.

================
Comment at: lib/StaticAnalyzer/Core/SymbolManager.cpp:496
@@ -495,5 +495,3 @@
     // location context, then the expression value is now "out of scope".
-    if (LCtx->isParentOf(ELCtx))
-      return false;
-    return true;
+    return !LCtx->isParentOf(ELCtx);
   }
----------------
I am OK with changing this one.


http://reviews.llvm.org/D10022





More information about the cfe-commits mailing list