Skip to content

Commit

Permalink
Revert "[analyzer][Solver] Early return if sym is concrete on assuming (
Browse files Browse the repository at this point in the history
#115579)"

This reverts commit 4163136.
  • Loading branch information
steakhal authored Nov 15, 2024
1 parent 1822754 commit 42c0948
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1354,8 +1354,6 @@ void StdLibraryFunctionsChecker::checkPreCall(const CallEvent &Call,
if (BR.isInteresting(ArgSVal))
OS << Msg;
}));
if (NewNode->isSink())
break;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ ConstraintManager::assumeDualImpl(ProgramStateRef &State,
// it might happen that a Checker uncoditionally uses one of them if the
// other is a nullptr. This may also happen with the non-dual and
// adjacent `assume(true)` and `assume(false)` calls. By implementing
// assume in terms of assumeDual, we can keep our API contract there as
// assume in therms of assumeDual, we can keep our API contract there as
// well.
return ProgramStatePair(StInfeasible, StInfeasible);
}
Expand Down
9 changes: 1 addition & 8 deletions clang/lib/StaticAnalyzer/Core/RangedConstraintManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,7 @@ RangedConstraintManager::~RangedConstraintManager() {}
ProgramStateRef RangedConstraintManager::assumeSym(ProgramStateRef State,
SymbolRef Sym,
bool Assumption) {
SVal SimplifiedVal = simplifyToSVal(State, Sym);
if (SimplifiedVal.isConstant()) {
bool Feasible = SimplifiedVal.isZeroConstant() != Assumption;
return Feasible ? State : nullptr;
}

if (SymbolRef SimplifiedSym = SimplifiedVal.getAsSymbol())
Sym = SimplifiedSym;
Sym = simplify(State, Sym);

// Handle SymbolData.
if (isa<SymbolData>(Sym))
Expand Down
37 changes: 0 additions & 37 deletions clang/test/Analysis/solver-sym-simplification-on-assumption.c

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ void test(int a, int b, int c, int d) {
return;
clang_analyzer_printState();
// CHECK: "constraints": [
// CHECK-NEXT: { "symbol": "((reg_$0<int a>) + (reg_$2<int c>)) != (reg_$3<int d>)", "range": "{ [0, 0] }" },
// CHECK-NEXT: { "symbol": "(reg_$0<int a>) != (reg_$3<int d>)", "range": "{ [0, 0] }" },
// CHECK-NEXT: { "symbol": "reg_$1<int b>", "range": "{ [0, 0] }" },
// CHECK-NEXT: { "symbol": "reg_$2<int c>", "range": "{ [0, 0] }" }
// CHECK-NEXT: ],
// CHECK-NEXT: "equivalence_classes": [
// CHECK-NEXT: [ "((reg_$0<int a>) + (reg_$2<int c>)) != (reg_$3<int d>)" ],
// CHECK-NEXT: [ "(reg_$0<int a>) + (reg_$2<int c>)", "reg_$3<int d>" ],
// CHECK-NEXT: [ "(reg_$0<int a>) != (reg_$3<int d>)" ],
// CHECK-NEXT: [ "reg_$0<int a>", "reg_$3<int d>" ],
// CHECK-NEXT: [ "reg_$2<int c>" ]
// CHECK-NEXT: ],
// CHECK-NEXT: "disequality_info": null,
Expand Down

0 comments on commit 42c0948

Please sign in to comment.