[clang] [analyzer] Improve solver (PR #112583)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 04:10:34 PDT 2024


================
@@ -2866,12 +2877,14 @@ ConditionTruthVal RangeConstraintManager::checkNull(ProgramStateRef State,
 
 const llvm::APSInt *RangeConstraintManager::getSymVal(ProgramStateRef St,
                                                       SymbolRef Sym) const {
-  const RangeSet *T = getConstraint(St, Sym);
-  return T ? T->getConcreteValue() : nullptr;
+  auto &MutableSelf = const_cast<RangeConstraintManager &>(*this);
+  return MutableSelf.getRange(St, Sym).getConcreteValue();
 }
 
 const llvm::APSInt *RangeConstraintManager::getSymMinVal(ProgramStateRef St,
                                                          SymbolRef Sym) const {
+  // TODO: Use `getRange()` like in `getSymVal()`, but that would make some
+  // of the reports of `BitwiseShiftChecker` look awkward.
----------------
steakhal wrote:

Yea, have a look at `clang/test/Analysis/bitwise-shift-common.c` now.

https://github.com/llvm/llvm-project/pull/112583


More information about the cfe-commits mailing list