diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h @@ -118,8 +118,6 @@ // overconstrained-related functions. We want to keep this API inaccessible // for Checkers. friend class ConstraintManager; - friend ProgramStateRef reAssume(ProgramStateRef State, - const RangeSet *Constraint, SVal TheValue); bool isPosteriorlyOverconstrained() const { return PosteriorlyOverconstrained; } diff --git a/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp --- a/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp @@ -46,6 +46,9 @@ ConstraintManager::ProgramStatePair ConstraintManager::assumeDualImpl(ProgramStateRef &State, AssumeFunction &Assume) { + if (State->isPosteriorlyOverconstrained()) + return {State, State}; + ProgramStateRef StTrue = Assume(true); if (!StTrue) { diff --git a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp --- a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -20,8 +20,8 @@ #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/ImmutableSet.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/raw_ostream.h" #include @@ -2535,19 +2535,10 @@ return State; } -// We must declare reAssume in clang::ento, otherwise we could not declare that -// as a friend in ProgramState. More precisely, the call of reAssume would be -// ambiguous (one in the global namespace and an other which is declared in -// ProgramState is in clang::ento). -namespace clang { -namespace ento { // Re-evaluate an SVal with top-level `State->assume` logic. LLVM_NODISCARD ProgramStateRef reAssume(ProgramStateRef State, const RangeSet *Constraint, SVal TheValue) { - assert(State); - if (State->isPosteriorlyOverconstrained()) - return nullptr; if (!Constraint) return State; @@ -2570,8 +2561,6 @@ return State->assumeInclusiveRange(DefinedVal, Constraint->getMinValue(), Constraint->getMaxValue(), true); } -} // namespace ento -} // namespace clang // Iterate over all symbols and try to simplify them. Once a symbol is // simplified then we check if we can merge the simplified symbol's equivalence