[PATCH] Refactor: Simplify boolean expressions in lib/AST
Richard
legalize at xmission.com
Tue Mar 24 09:20:12 PDT 2015
In http://reviews.llvm.org/D8532#145854, @djasper wrote:
> I don't feel strongly about this, and I can see some of your reasoning.
> However, an "if (a) return true; else return false;" is very suspect to me
> and I think "return a;" is more readable, independent of whether it is at
> the end of a chain or not.
This is my view on readability as well and one of the reasons I wrote this check for `clang-tidy`.
These patches arose from me trying out the new check on a "real codebase" instead of my single lint based test file. A couple of issues arose from applying the new check on the code that is helping me to improve my check beyond just handling the basics, so this is all great feedback for me, even if the patches don't get accepted.
The LLVM coding rule of "no `else` after a `return`, `continue`, etc." probably should be turned into a clang-tidy check, at least for detection if not correction.
http://reviews.llvm.org/D8532
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list