[PATCH] D113753: [Analyzer][Core] Better simplification in SimpleSValBuilder::evalBinOpNN

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 3 00:41:28 PST 2021


martong added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:372
                                   QualType resultTy)  {
   NonLoc InputLHS = lhs;
   NonLoc InputRHS = rhs;
----------------
steakhal wrote:
> @martong, you simplified the operands, but you overwrite only the lhs and rhs. Shouldnt you overwite these as well?
> What is the purpose of these variables, do you know?
> @martong, you simplified the operands, but you overwrite only the lhs and rhs. Shouldnt you overwite these as well?
> What is the purpose of these variables, do you know?

They are used exclusively to create `SymExpr`s with `makeSymExprValNN` when both lhs and rhs are symbols. If we were to simplify the `Input` variables then it might happen that we end up with a non symbol (i.e. a concrete int) and then `makeSymExprValNN` would fail miserably (would assert I guess). 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113753



More information about the cfe-commits mailing list