[PATCH] Refactor: Simplify boolean expressions in llvm-nm

David Blaikie dblaikie at gmail.com
Mon Mar 23 14:21:06 PDT 2015


On Mon, Mar 23, 2015 at 1:48 PM, Richard <legalize at xmission.com> wrote:

>
> In article <
> CAENS6EtScu6-nzsJk5V+O8J1LbgBpYtQeu9NtYrMJ-UQ0Kkw1g at mail.gmail.com>,
>     David Blaikie <dblaikie at gmail.com> writes:
>
> > If we changed the code to:
> >
> > if (x)
> >   return true;
> > return false;
> >
> > would it still trigger the cleanup check you're using?
>
> Nope.
>
> The tool explicitly looks for 'if (e) return true; else return false;'
> and replaces that with 'return e;'
>

Cool - yeah, any time that part of the check fires we should at least be
fixing it by removing the else - but sometimes it does make sense to just
roll the whole conditional expression into the return statement.

Committed the else-after-return cleanups & some other stuff I saw in r233025


> --
> "The Direct3D Graphics Pipeline" free book <
> http://tinyurl.com/d3d-pipeline>
>      The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
>          The Terminals Wiki <http://terminals.classiccmp.org>
>   Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150323/0d673e31/attachment.html>


More information about the llvm-commits mailing list