[PATCH] Refactor: Simplify boolean expressions in lib/AST

Daniel Jasper djasper at google.com
Wed Mar 25 07:50:07 PDT 2015


On Tue, Mar 24, 2015 at 5:20 PM, Richard <legalize at xmission.com> wrote:

> 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.
>

I have committed an initial version of such a check in r226025.


> http://reviews.llvm.org/D8532
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150325/4f9ad99e/attachment.html>


More information about the cfe-commits mailing list