[all-commits] [llvm/llvm-project] 8ddbb4: [Analyzer][solver] Simplify existing eq classes an...

Gabor Marton via All-commits all-commits at lists.llvm.org
Mon Jun 14 03:19:42 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8ddbb442b6e87efc9c6599280740c6f4fc40963d
      https://github.com/llvm/llvm-project/commit/8ddbb442b6e87efc9c6599280740c6f4fc40963d
  Author: Gabor Marton <gabor.marton at ericsson.com>
  Date:   2021-06-14 (Mon, 14 Jun 2021)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h
    M clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
    A clang/test/Analysis/find-binop-constraints.cpp

  Log Message:
  -----------
  [Analyzer][solver] Simplify existing eq classes and constraints when a new constraint is added

Update `setConstraint` to simplify existing equivalence classes when a
new constraint is added. In this patch we iterate over all existing
equivalence classes and constraints and try to simplfy them with
simplifySVal. This solves problematic cases where we have two symbols in
the tree, e.g.:
```
int test_rhs_further_constrained(int x, int y) {
  if (x + y != 0)
    return 0;
  if (y != 0)
    return 0;
  clang_analyzer_eval(x + y == 0); // expected-warning{{TRUE}}
  clang_analyzer_eval(y == 0);     // expected-warning{{TRUE}}
  return 0;
}
```

Differential Revision: https://reviews.llvm.org/D103314




More information about the All-commits mailing list