[clang] [analyzer] Preserve LocAsInteger through identity operations (PR #225048)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 23 07:17:10 PDT 2026
================
@@ -491,6 +510,11 @@ SVal SimpleSValBuilder::evalBinOpNN(ProgramStateRef state,
rhs.castAs<nonloc::LocAsInteger>().getLoc(),
resultTy);
case nonloc::ConcreteIntKind: {
+ // Preserve the location for identity operations.
+ if (isIdentityOperation(op,
+ rhs.castAs<nonloc::ConcreteInt>().getValue()))
+ return evalCast(lhs, resultTy, QualType{});
+
----------------
steakhal wrote:
This makes me wonder if we want to do this canonicalization at more places. Is this the only place where it makes sense? I wonder if the swapped operand case is handled.
https://github.com/llvm/llvm-project/pull/225048
More information about the cfe-commits
mailing list