[PATCH] check for Incorrect logic in operator

Ted Kremenek kremenek at apple.com
Mon Oct 28 11:41:31 PDT 2013

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?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131028/ba72219c/attachment.html>

More information about the cfe-commits mailing list