[PATCH] check for Incorrect logic in operator
Ted Kremenek
kremenek at apple.com
Mon Oct 28 11:47:22 PDT 2013
On Oct 28, 2013, at 11:41 AM, Ted Kremenek <kremenek at apple.com> wrote:
> On Oct 25, 2013, at 4:42 PM, Richard Trieu <rtrieu at google.com> wrote:
>
>> If you check out -Wlogical-not-parentheses and -Wtautological-compare-out-of-range, they are in lib/Sema/SemaChecking.cpp. Why did you use a CFG approach instead?
>
> Hi Richard,
>
> I told Anders that modifying the CFG builder would be an interesting approach for two reasons:
>
> (1) The CFG is used for a variety of dataflow analyses, thus folding this “smarts” into the CFG builder seems to have dividends for other uses.
>
> (2) The CFG builder already does some branch pruning by doing some simply analysis of expressions at branches. This seemed like a natural enhancement.
>
> I did consider this to take a similar approach to -Wlogical-not-parentheses, but thought this would be a more promising direction to explore.
>
> Flipping the question around, do you think it would be interesting to consider the opposite approach and move the logic to -Wlogical-not-parentheses, etc., into the CFG builder, for the same reasons I have given above?
>
> Ted
Further, there is a very natural relationship between *all* of these warnings and -Wunreachable-code (a warning we’d one day like to fully productize), which is built directly on top of the CFG. Bringing the underlying pieces closer together seems like a promising direction to explore.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131028/236cccaf/attachment.html>
More information about the cfe-commits
mailing list