facebook / infer

A static analyzer for Java, C, C++, and Objective-C
http://fbinfer.com/
MIT License
14.8k stars 2k forks source link

How to add extra nullability condition to NULL_DEREFERENCE checking #1790

Closed csmoe closed 10 months ago

csmoe commented 10 months ago

I'm trying to run infer on a chromium-forked project, in addition to short-circuiting like p & p->foo, chromium provides macros like CHECK/DCHECK to guard dereference:

DCHECK(p);
...
...
p->foo()

infer reports lots of NULL_DEREF on p->foo(), I wanna filter out those.

If infer cannot do this with options or .inferconfig currently, Could you given me some instructions to contribute on the related checking code? Thanks :)