OSDN Git Service

[analyzer] Refactor range inference for symbolic expressions
authorValeriy Savchenko <vsavchenko@apple.com>
Fri, 1 May 2020 08:49:23 +0000 (11:49 +0300)
committerValeriy Savchenko <vsavchenko@apple.com>
Thu, 28 May 2020 15:54:52 +0000 (18:54 +0300)
commit1f57d76a8dd00611aaa4b33048be195ea9a2dc44
tree23adc758400a511bf26ae4ea6eeccbabeca60c45
parentbb2ae74717a25ba268e7bd17a2a572d931ed094e
[analyzer] Refactor range inference for symbolic expressions

Summary:
This change introduces a new component to unite all of the reasoning
we have about operations on ranges in the analyzer's solver.
In many cases, we might conclude that the range for a symbolic operation
is much more narrow than the type implies.  While reasoning about
runtime conditions (especially in loops), we need to support more and
more of those little pieces of logic.  The new component mostly plays
a role of an organizer for those, and allows us to focus on the actual
reasoning about ranges and not dispatching manually on the types of the
nested symbolic expressions.

Differential Revision: https://reviews.llvm.org/D79232
clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h
clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
clang/test/Analysis/constant-folding.c
clang/test/Analysis/double-ranges-bug.c [new file with mode: 0644]