]> granicus.if.org Git - clang/commit
[analyzer] Nullability: Don't detect post factum violation on concrete values.
authorArtem Dergachev <artem.dergachev@gmail.com>
Fri, 30 Nov 2018 03:39:58 +0000 (03:39 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Fri, 30 Nov 2018 03:39:58 +0000 (03:39 +0000)
commit4d1d8f287a82495809b15297ddd7115bffb31037
tree7df661cc7a32949a1df5e06ccd57b8e6b8f46458
parent447f4b58b06fc1427e4ef437165513949dac5b08
[analyzer] Nullability: Don't detect post factum violation on concrete values.

The checker suppresses warnings on paths on which a nonnull value is assumed
to be nullable. This probably deserves a warning, but it's a separate story.

Now, because dead symbol collection fires in pretty random moments,
there sometimes was a situation when dead symbol collection fired after
computing a parameter but before actually evaluating call enter into the
function, which triggered the suppression when the argument was null
in the first place earlier than the obvious warning for null-to-nonnull
was emitted, causing false negatives.

Only trigger the suppression for symbols, not for concrete values.

It is impossible to constrain a concrete value post-factum because
it is impossible to constrain a concrete value at all.

This covers all the necessary cases because by the time we reach the call,
symbolic values should be either not constrained to null, or already collapsed
into concrete null values. Which in turn happens because they are passed through
the Store, and the respective collapse is implemented as part of getSVal(),
which is also weird.

Differential Revision: https://reviews.llvm.org/D54017

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347954 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
test/Analysis/nullability-arc.mm [new file with mode: 0644]
test/Analysis/nullability.mm