[analyzer] Fix assertion failure after getKnownValue call
authorGabor Marton <gabor.marton@ericsson.com>
Wed, 8 Jun 2022 10:11:21 +0000 (12:11 +0200)
committerGabor Marton <gabor.marton@ericsson.com>
Thu, 9 Jun 2022 14:13:57 +0000 (16:13 +0200)
commitbc2c759aeee7d1560840a24365ce18b8e8b63ded
treed0c5fb1a4ca8dcef18887f1cf4795680266604c7
parentb8c2781ff60126b8c7c11ed0dab90d0640a17d4f
[analyzer] Fix assertion failure after getKnownValue call

Depends on D126560. `getKnownValue` has been changed by the parent patch
in a way that simplification was removed. This is not correct when the
function is called by the Checkers. Thus, a new internal function is
introduced, `getConstValue`, which simply queries the constraint manager.
This `getConstValue` is used internally in the `SimpleSValBuilder` when a
binop is evaluated, this way we avoid the recursion into the `Simplifier`.

Differential Revision: https://reviews.llvm.org/D127285
clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
clang/test/Analysis/svalbuilder-simplify-no-crash.c [new file with mode: 0644]