[clang] [analyzer] Improve solver (PR #112583)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 04:03:08 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());
----------------
steakhal wrote:

Uhh, yes. That was a nasty bug. Thanks for spotting it!

https://github.com/llvm/llvm-project/pull/112583


More information about the cfe-commits mailing list