vsavchenko added inline comments.

================
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();
+
----------------
ASDenysPetrov wrote:
> 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`.
Aha, I see your point.  I guess we can take it into `SymExpr` and call it not 
`getRootOperand`, which won't tell much to a person reading the name, but 
something like `ignoreCasts`.  It will fit well with `Expr::IgnoreCasts`, 
`Expr::IgnoreParens`, etc.


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