[PATCH] Add readability-simplify-boolean-expr check to clang-tidy

David Blaikie dblaikie at gmail.com
Sun Feb 15 18:09:39 PST 2015


On Sun, Feb 15, 2015 at 6:04 PM, Richard <legalize at xmission.com> wrote:

> Thinking about this a little more, I'm conflicted as to whether or not it
> should allow the simplification if the boolean constant came from a macro.
> If the macro is a feature detection macro, then I'm enabling/disabling
> chunks of code at runtime based on the resolution of the feature detection
> and I shouldn't be so quick to simplify that to always true or always false.
>

I believe that was Ismael's point, if it wasn't at least it's mine. It's
unfortunate to whitelist all macros like that, but I think it'll be
necessary to get the false positive % down. Check out similar changes Ted
Kremenek made to Clang's -Wunreachable-code warning to reduce the false
positives about a year ago. You'll find that if (MACRO) { ... } else { ...
} doesn't produce an unreachable code warning on either path.


>
>
> http://reviews.llvm.org/D7648
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150215/ef4be543/attachment.html>


More information about the cfe-commits mailing list