ASDenysPetrov added a comment.

I found some issues. Working on improvement.



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


================
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();
+
----------------
vsavchenko wrote:
> This looks like a pattern and we should probably make into a method of 
> `SymbolCast`
I did it :) but refused. It will just turn into:
```
  if (isa<SymbolCast>(Sym))
    Sym = cast<SymbolCast>(Sym)->getRootOperand();
```
It looks pretty the same and brings no benefit IMO, does it?
Every time I used `getRootOperand` I also needed some additional traverse 
through the types te get some another information, so I couldn't avoid the 
`while` loop there. So I decided not to introduce a new method in `SymbolCast`.


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

https://reviews.llvm.org/D103096

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to