[analyzer] Do not report CFError null dereference for nonnull params.
authorValeriy Savchenko <vsavchenko@apple.com>
Mon, 20 Apr 2020 08:08:57 +0000 (11:08 +0300)
committerArtem Dergachev <artem.dergachev@gmail.com>
Mon, 20 Apr 2020 09:33:01 +0000 (12:33 +0300)
commit1f67508b7fedb3a0c8ea55a1f5674346563e2bf2
tree844ed039f88b47320fc32095ff121f6a28fc080f
parent09a1f090509eb5971ade7089330008c6e4024d30
[analyzer] Do not report CFError null dereference for nonnull params.

We want to trust user type annotations and stop assuming pointers declared
as nonnull still can be null. This functionality is implemented as part
of NonNullParamChecker because it already checks parameter attributes.
Whenever we start analyzing a new function, we assume that all parameters
with 'nonnull' attribute are indeed non-null.

Patch by Valeriy Savchenko!

Differential Revision: https://reviews.llvm.org/D77806
clang/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp
clang/test/Analysis/CheckNSError.m
clang/test/Analysis/UserNullabilityAnnotations.m [new file with mode: 0644]
clang/test/Analysis/nonnull.cpp [new file with mode: 0644]