[cfe-dev] null pointer warning
Chris Lattner
clattner at apple.com
Tue Jul 6 23:16:02 PDT 2010
On Jul 5, 2010, at 1:35 PM, John McCall wrote:
> On Jul 5, 2010, at 12:20 PM, Chris Lattner wrote:
>> Is there a better place to slot this into Sema? I didn't follow the warning work John did, but it seems like it must have had to solve similar problems.
>
> CheckImplicitConversions triggers on a full-expression and walks the entire expression tree, but it does so for much better reasons. I think what you really want to do is to hook the lvalue-to-rvalue conversion; I'm not sure if there's a single point where that happens, though.
>
> Presumably you also want to not warn on
> int &ref = *(int*) 0;
> ?
After discussion, it turns out that this is a lot harder than it should be. Instead of handling the general case, I just ended up doing a syntactic check in r107756. The static analyzer already handles the more complex cases in a far more general way, let it do its job :)
Thanks John,
-Chris
More information about the cfe-dev
mailing list