[Analyzer] Track RValue expressions
authorGabor Marton <gabor.marton@ericsson.com>
Thu, 25 Mar 2021 14:40:26 +0000 (15:40 +0100)
committerGabor Marton <gabor.marton@ericsson.com>
Tue, 30 Mar 2021 12:48:38 +0000 (14:48 +0200)
commitefa7df1682c2859dabe3646ee7dc01e68629417f
tree4a41b15690f4dc976514ab196fba5e304cfdbc69
parent1696b8ae96b2d8bcbf90894bd344a8a090f43c84
[Analyzer] Track RValue expressions

It makes sense to track rvalue expressions in the case of special
concrete integer values. The most notable special value is zero (later
we may find other values). By tracking the origin of 0, we can provide a
better explanation for users e.g. in case of division by 0 warnings.
When the divisor is a product of a multiplication then now we can show
which operand (or both) was (were) zero and why.

Differential Revision: https://reviews.llvm.org/D99344
clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
clang/test/Analysis/division-by-zero-track-zero.c [new file with mode: 0644]
clang/test/Analysis/division-by-zero-track-zero.cpp [new file with mode: 0644]
clang/test/Analysis/nullptr.cpp