[PATCH] D77722: [analyzer] Do not report NSError null dereference for _Nonnull params

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 8 07:02:32 PDT 2020


vsavchenko added a comment.

In D77722#1969391 <https://reviews.llvm.org/D77722#1969391>, @Szelethus wrote:

> In D77722#1969261 <https://reviews.llvm.org/D77722#1969261>, @vsavchenko wrote:
>
> > Hi everyone!
> >  I'm thinking about adding support for `__attribute((nonnull))__` as well, but it should be handled a bit differently. That annotation is for parameters and not for types, so the corresponding constraints should be generated only when entering the function (as opposed to each load). I'm not sure that it should be a part of this commit though because it will have a completely standalone solution. Another question about `__attribute((nonnull))__` is "Where should we put it?".  It is quite reasonable to put it into `NullabilityChecker`, but `NonnullParamChecker` seems like a good candidate as well.
>
>
> Wait, we don't already assume `nonnull` attributed parameters as, well, not null? That's crazy.


Yep, I was shocked by it as well. Maybe for some warnings it is checked in the end and they are truncated before reporting. However, DereferenceChecker definitely dispatches `ImplicitNullDerefEvent` for params marked with `__attribute__((nonnull))`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77722/new/

https://reviews.llvm.org/D77722





More information about the cfe-commits mailing list