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

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 6 04:12:16 PDT 2021


vsavchenko added a comment.

This is a very complicated patch, I think we'll have to iterate on it quite a lot.
Additionally, we have to be sure that this doesn't crash our performance.



================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1131
 
+class NominalTypeList {
+  CanQualType Types[4];
----------------
Comments on:
* why do we need it?
* why does it have four types?
* why do we not care about signed/unsigned types?


================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:2797-2799
+ProgramStateRef
+RangeConstraintManager::updateExistingConstraints(ProgramStateRef State,
+                                                  SymbolRef Sym, RangeSet R) {
----------------
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?



================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:2801-2802
+  // Get a root symbol in case of SymbolCast.
+  while (isa<SymbolCast>(Sym))
+    Sym = cast<SymbolCast>(Sym)->getOperand();
+
----------------
This looks like a pattern and we should probably make into a method of `SymbolCast`


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

https://reviews.llvm.org/D103096



More information about the cfe-commits mailing list