[PATCH] D126481: [analyzer] Handle SymbolCast in SValBuilder

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 27 11:14:46 PDT 2022


ASDenysPetrov added a comment.

@martong As you said, my solution D103096 <https://reviews.llvm.org/D103096> suppose to pass these and more other tests cases. So how it will help in combination with my solution D103096 <https://reviews.llvm.org/D103096>? 
Although, your patch is really simple but it's more like a plug then a real `SymbolCast ` support, isn't it? I don't quite understand the motivation.



================
Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:1354
+        return I->second;
+      const SymExpr *OpSym = S->getOperand();
+      SVal OpVal = getConstOrVisit(OpSym);
----------------
Should this imply to use the root symbol and not the second nested one?
E.g. from `(int)(short)(x)` do you want `(short)(x)` or `(x)`?
`getOperand` gives you `(short)(x)` in this case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126481



More information about the cfe-commits mailing list