[PATCH] D103096: [analyzer] Implement cast for ranges of symbolic integers.

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 9 03:21:24 PDT 2021


ASDenysPetrov added a comment.

@vsavchenko



================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:2797-2799
+ProgramStateRef
+RangeConstraintManager::updateExistingConstraints(ProgramStateRef State,
+                                                  SymbolRef Sym, RangeSet R) {
----------------
ASDenysPetrov wrote:
> vsavchenko wrote:
> > OK, but I still don't understand one thing.
> > Here you go over all "smaller" types and artificially create constraints for them, and at the same time in `VisitSymbolCast` you do the opposite operation?  Why?  Shouldn't the map have constraints for smaller types already because of this action?  Why do we need to do both?
> > 
> I've been preparing an answer for you, but suddenly you inspired me on some impovements. Thanks.
I've fixed `RangeConstraintManager::updateExistingConstraints`. There was a mistake when I update smaller types from the **root** symbol, but correct symbol is the **given** symbol which is before calling `ignoreCast()`.
May be now it would be more clear for you.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103096/new/

https://reviews.llvm.org/D103096



More information about the cfe-commits mailing list