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

Alexander Kornienko alexfh at google.com
Tue May 26 07:08:50 PDT 2015


================
Comment at: lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:693
@@ -692,3 +692,1 @@
   CXXBasePaths Paths(false, false, false);
-  if (RD->lookupInBases(&CXXRecordDecl::FindOrdinaryMember,
-                        DeclName.getAsOpaquePtr(),
----------------
I'd leave alone code that is structured like a chain of conditions with a default in the end:

  if (X)
    return true;
  if (Y)
    return true;
  ...
  if (Z)
    return true;
  return false;

It's arguable whether changing the last if + return to `return Z;` makes the code more readable, so I'd just keep them as is.

http://reviews.llvm.org/D10022

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






More information about the cfe-commits mailing list