Skip to content

Commit 8d43c88

Browse files
authored
Revert "[analyzer][Solver] Early return if sym is concrete on assuming" (llvm#116362)
Reverts llvm#115579 This introduced a breakage: https://lab.llvm.org/buildbot/#/builders/46/builds/7928
1 parent 1822754 commit 8d43c88

6 files changed

+5
-94
lines changed

clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,8 +1354,6 @@ void StdLibraryFunctionsChecker::checkPreCall(const CallEvent &Call,
13541354
if (BR.isInteresting(ArgSVal))
13551355
OS << Msg;
13561356
}));
1357-
if (NewNode->isSink())
1358-
break;
13591357
}
13601358
}
13611359
}

clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ ConstraintManager::assumeDualImpl(ProgramStateRef &State,
7474
// it might happen that a Checker uncoditionally uses one of them if the
7575
// other is a nullptr. This may also happen with the non-dual and
7676
// adjacent `assume(true)` and `assume(false)` calls. By implementing
77-
// assume in terms of assumeDual, we can keep our API contract there as
77+
// assume in therms of assumeDual, we can keep our API contract there as
7878
// well.
7979
return ProgramStatePair(StInfeasible, StInfeasible);
8080
}

clang/lib/StaticAnalyzer/Core/RangedConstraintManager.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,7 @@ RangedConstraintManager::~RangedConstraintManager() {}
2323
ProgramStateRef RangedConstraintManager::assumeSym(ProgramStateRef State,
2424
SymbolRef Sym,
2525
bool Assumption) {
26-
SVal SimplifiedVal = simplifyToSVal(State, Sym);
27-
if (SimplifiedVal.isConstant()) {
28-
bool Feasible = SimplifiedVal.isZeroConstant() != Assumption;
29-
return Feasible ? State : nullptr;
30-
}
31-
32-
if (SymbolRef SimplifiedSym = SimplifiedVal.getAsSymbol())
33-
Sym = SimplifiedSym;
26+
Sym = simplify(State, Sym);
3427

3528
// Handle SymbolData.
3629
if (isa<SymbolData>(Sym))

clang/test/Analysis/solver-sym-simplification-on-assumption.c

Lines changed: 0 additions & 37 deletions
This file was deleted.

clang/test/Analysis/std-c-library-functions-bufsize-nocrash-with-correct-solver.c

Lines changed: 0 additions & 43 deletions
This file was deleted.

clang/test/Analysis/symbol-simplification-fixpoint-two-iterations.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ void test(int a, int b, int c, int d) {
2828
return;
2929
clang_analyzer_printState();
3030
// CHECK: "constraints": [
31-
// CHECK-NEXT: { "symbol": "((reg_$0<int a>) + (reg_$2<int c>)) != (reg_$3<int d>)", "range": "{ [0, 0] }" },
31+
// CHECK-NEXT: { "symbol": "(reg_$0<int a>) != (reg_$3<int d>)", "range": "{ [0, 0] }" },
3232
// CHECK-NEXT: { "symbol": "reg_$1<int b>", "range": "{ [0, 0] }" },
3333
// CHECK-NEXT: { "symbol": "reg_$2<int c>", "range": "{ [0, 0] }" }
3434
// CHECK-NEXT: ],
3535
// CHECK-NEXT: "equivalence_classes": [
36-
// CHECK-NEXT: [ "((reg_$0<int a>) + (reg_$2<int c>)) != (reg_$3<int d>)" ],
37-
// CHECK-NEXT: [ "(reg_$0<int a>) + (reg_$2<int c>)", "reg_$3<int d>" ],
36+
// CHECK-NEXT: [ "(reg_$0<int a>) != (reg_$3<int d>)" ],
37+
// CHECK-NEXT: [ "reg_$0<int a>", "reg_$3<int d>" ],
3838
// CHECK-NEXT: [ "reg_$2<int c>" ]
3939
// CHECK-NEXT: ],
4040
// CHECK-NEXT: "disequality_info": null,

0 commit comments

Comments
 (0)