[PATCH] D113753: [Analyzer][Core] Better simplification in SimpleSValBuilder::evalBinOpNN
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 23 06:26:15 PST 2021
martong marked 2 inline comments as done.
martong added a comment.
I'm attaching the coverage of the new test file for the related change:
375 : // Constraints may have changed since the creation of a bound SVal. Check if
376 : // the values can be simplified based on those new constraints.
377 12 : SVal simplifiedLhs = simplifySVal(state, lhs);
378 12 : SVal simplifiedRhs = simplifySVal(state, rhs);
379 12 : if (auto simplifiedLhsAsNonLoc = simplifiedLhs.getAs<NonLoc>())
380 12 : lhs = *simplifiedLhsAsNonLoc;
381 12 : if (auto simplifiedRhsAsNonLoc = simplifiedRhs.getAs<NonLoc>())
382 12 : rhs = *simplifiedRhsAsNonLoc;
383 :
================
Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:378
+ SVal simplifiedLhs = simplifySVal(state, lhs);
+ SVal simplifiedRhs = simplifySVal(state, rhs);
+ if (auto simplifiedLhsAsNonLoc = simplifiedLhs.getAs<NonLoc>())
----------------
steakhal wrote:
> It seems like you simplify the `rhs` as well. Could we have a test for that?
Ok, I've added a new test case and reworked the existing a bit.
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