[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 13 12:07:48 PDT 2024


================
@@ -57,10 +57,14 @@ ProgramStateRef SimpleConstraintManager::assumeAux(ProgramStateRef State,
   // We cannot reason about SymSymExprs, and can only reason about some
   // SymIntExprs.
   if (!canReasonAbout(Cond)) {
-    // Just add the constraint to the expression without trying to simplify.
     SymbolRef Sym = Cond.getAsSymbol();
-    assert(Sym);
-    return assumeSymUnsupported(State, Sym, Assumption);
+    if (Sym) {
+      // this will simplify the symbol, so only call this if we have a
+      // symbol.
+      return assumeSymUnsupported(State, Sym, Assumption);
+    } else {
+      return State;
+    }
----------------
steakhal wrote:

```suggestion
    if (SymbolRef Sym = Cond.getAsSymbol())
      return assumeSymUnsupported(State, Sym, Assumption);
    return State;
```

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


More information about the cfe-commits mailing list