[clang] [analyzer] Improve solver (PR #112583)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 17 02:13:39 PDT 2024
================
@@ -1485,6 +1487,18 @@ class SymbolicRangeInferrer
Sym->getType());
}
+ std::optional<RangeSet> getRangeCommutativeSymSym(const SymSymExpr *SSE) {
+ bool IsCommutative = llvm::is_contained({BO_Add, BO_Mul}, SSE->getOpcode());
+ if (!IsCommutative)
+ return std::nullopt;
+
+ SymbolRef Commuted = State->getSymbolManager().getSymSymExpr(
+ SSE->getRHS(), BO_Add, SSE->getLHS(), SSE->getType());
----------------
NagyDonat wrote:
```suggestion
SSE->getRHS(), SSE->getOpcode(), SSE->getLHS(), SSE->getType());
```
Don't hardcode addition here!
https://github.com/llvm/llvm-project/pull/112583
More information about the cfe-commits
mailing list