[analyzer] Generalize bitwise AND rules for ranges
authorValeriy Savchenko <vsavchenko@apple.com>
Tue, 5 May 2020 16:42:33 +0000 (19:42 +0300)
committerValeriy Savchenko <vsavchenko@apple.com>
Thu, 28 May 2020 15:55:49 +0000 (18:55 +0300)
commit2a09daff0f902e70a08f2b30f3461fb8848f5ab1
tree12106809cddc96604f122295912b7a08375bf0c0
parent47c4b8bd68698b1827f39c3056783ed042faf718
[analyzer] Generalize bitwise AND rules for ranges

Summary:
Previously the current solver started reasoning about bitwise AND
expressions only when one of the operands is a constant.  However,
very similar logic could be applied to ranges.  This commit addresses
this shortcoming.  Additionally, it refines how we deal with negative
operands.

rdar://problem/54359410

Differential Revision: https://reviews.llvm.org/D79434
clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
clang/test/Analysis/constant-folding.c
clang/test/Analysis/switch-case.c
clang/test/Analysis/uninit-exhaustive-switch-bug.c [new file with mode: 0644]