This is an archive of the discontinued LLVM Phabricator instance.

Refactor: Simplify boolean conditional return statements in lib/StaticAnalyzer/Core
AbandonedPublic

Authored by LegalizeAdulthood on May 25 2015, 3:12 PM.

Details

Reviewers
jordan_rose
Summary

Use clang-tidy to simplify boolean conditional return statements

Diff Detail

Event Timeline

LegalizeAdulthood retitled this revision from to Refactor: Simplify boolean conditional return statements in lib/StaticAnalyzer/Core.
LegalizeAdulthood updated this object.
LegalizeAdulthood edited the test plan for this revision. (Show Details)
LegalizeAdulthood added a subscriber: Unknown Object (MLST).
alexfh added a subscriber: alexfh.May 26 2015, 7:08 AM
alexfh added inline comments.
lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
692–693

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.

Update from latest

lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
692–693

In this case it isn't a simple if-return, if-return, if-return.

zaks.anna added inline comments.Oct 28 2015, 2:57 PM
lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
692–693

I agree that we should keep these as is for better readability and maintainability.

lib/StaticAnalyzer/Core/SValBuilder.cpp
397

Same chaining pattern here. I do not think it should change.

lib/StaticAnalyzer/Core/SymbolManager.cpp
496

I am OK with changing this one.

zaks.anna resigned from this revision.Jan 6 2016, 11:50 AM
zaks.anna removed a reviewer: zaks.anna.
LegalizeAdulthood abandoned this revision.Feb 19 2016, 9:22 AM