[PATCH] check for Incorrect logic in operator
jordan_rose at apple.com
Wed Oct 30 09:28:02 PDT 2013
On Oct 29, 2013, at 19:14 , Richard Trieu <rtrieu at google.com> wrote:
> With these points in mind, are there particular concerns about cases where the “CFG won’t check all the code a Sema based warning would”. If you addressed the last point, I think you’d pretty much get the coverage that you want. What do you think?
> I think that globals and global initializers are not represented in the CFG. That's my main concern about using only the CFG at the moment.
I don't think it would be difficult to build a CFG from a single global initializer (or member initializer). No one's done it yet, but I don't think that means it can't be done.
On the more general issue I can see both sides: avoiding extra walks over the AST or CFG is good, knowing what's trivially dead code is good (except when it isn't), and not conflating concerns is good.
For these particular checks, though (and I haven't looked at the patch, just the checks), I think they are fundamentally syntactic checks, not flow-sensitive ones, and that we will actually get little benefit out of using this information to improve the CFG. Each case is warning about a likely-incorrect boolean expression, which implies that if the user fixed the expression we could easily get a different CFG. That doesn't help answer questions of general policy, but it might at least untangle this patch from the discussion.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits