================ @@ -2883,22 +2883,16 @@ const llvm::APSInt *RangeConstraintManager::getSymVal(ProgramStateRef St, 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. - const RangeSet *T = getConstraint(St, Sym); - if (!T || T->isEmpty()) - return nullptr; - return &T->getMinValue(); + auto &MutableSelf = const_cast<RangeConstraintManager &>(*this); + RangeSet Range = MutableSelf.getRange(St, Sym); + return Range.isEmpty() ? nullptr : &Range.getMinValue(); } const llvm::APSInt *RangeConstraintManager::getSymMaxVal(ProgramStateRef St, SymbolRef Sym) const { - // TODO: Use `getRange()` like in `getSymVal()`, but that would make some - // of the reports of `BitwiseShiftChecker` look awkward. - const RangeSet *T = getConstraint(St, Sym); - if (!T || T->isEmpty()) - return nullptr; - return &T->getMaxValue(); + auto &MutableSelf = const_cast<RangeConstraintManager &>(*this); + RangeSet Range = MutableSelf.getRange(St, Sym); ---------------- NagyDonat wrote:
Now that I think about it, why is `getRange` not a `const` method? As far as I see, it returns a `RangeSet` by value and its typical usage looks like ```cpp RangeSet New = getRange(St, Sym); New = F.deletePoint(New, Point); return setRange(St, Sym, New); ``` and while I didn't review its (complex, visitor-based) definition, semantically I don't think that it should modify anything. https://github.com/llvm/llvm-project/pull/112583 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits