[clang] e2a2c83 - [Analyzer][NFC] Add RangedConstraintManager to ConstraintAssignor
Gabor Marton via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 22 01:46:39 PDT 2021
Author: Gabor Marton
Date: 2021-10-22T10:46:28+02:00
New Revision: e2a2c8328f573c792dcf8707b6adb88fa38cca11
URL: https://github.com/llvm/llvm-project/commit/e2a2c8328f573c792dcf8707b6adb88fa38cca11
DIFF: https://github.com/llvm/llvm-project/commit/e2a2c8328f573c792dcf8707b6adb88fa38cca11.diff
LOG: [Analyzer][NFC] Add RangedConstraintManager to ConstraintAssignor
In this patch we store a reference to `RangedConstraintManager` in the
`ConstraintAssignor`. This way it is possible to call back and reuse some
functions of it. This patch is exclusively needed for its child patches,
it is not intended to be a standalone patch.
Differential Revision: https://reviews.llvm.org/D111640
Added:
Modified:
clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
Removed:
################################################################################
diff --git a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
index 8df0a58914a7..7df9027b373d 100644
--- a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
+++ b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
@@ -1600,12 +1600,13 @@ class ConstraintAssignor : public ConstraintAssignorBase<ConstraintAssignor> {
public:
template <class ClassOrSymbol>
LLVM_NODISCARD static ProgramStateRef
- assign(ProgramStateRef State, SValBuilder &Builder, RangeSet::Factory &F,
- ClassOrSymbol CoS, RangeSet NewConstraint) {
+ assign(ProgramStateRef State, RangeConstraintManager &RCM,
+ SValBuilder &Builder, RangeSet::Factory &F, ClassOrSymbol CoS,
+ RangeSet NewConstraint) {
if (!State || NewConstraint.isEmpty())
return nullptr;
- ConstraintAssignor Assignor{State, Builder, F};
+ ConstraintAssignor Assignor{State, RCM, Builder, F};
return Assignor.assign(CoS, NewConstraint);
}
@@ -1614,9 +1615,9 @@ class ConstraintAssignor : public ConstraintAssignorBase<ConstraintAssignor> {
RangeSet Constraint);
private:
- ConstraintAssignor(ProgramStateRef State, SValBuilder &Builder,
- RangeSet::Factory &F)
- : State(State), Builder(Builder), RangeFactory(F) {}
+ ConstraintAssignor(ProgramStateRef State, RangeConstraintManager &RCM,
+ SValBuilder &Builder, RangeSet::Factory &F)
+ : State(State), RCM(RCM), Builder(Builder), RangeFactory(F) {}
using Base = ConstraintAssignorBase<ConstraintAssignor>;
/// Base method for handling new constraints for symbols.
@@ -1696,6 +1697,7 @@ class ConstraintAssignor : public ConstraintAssignorBase<ConstraintAssignor> {
}
ProgramStateRef State;
+ RangeConstraintManager &RCM;
SValBuilder &Builder;
RangeSet::Factory &RangeFactory;
};
@@ -2420,7 +2422,8 @@ RangeSet RangeConstraintManager::getRange(ProgramStateRef State,
ProgramStateRef RangeConstraintManager::setRange(ProgramStateRef State,
SymbolRef Sym,
RangeSet Range) {
- return ConstraintAssignor::assign(State, getSValBuilder(), F, Sym, Range);
+ return ConstraintAssignor::assign(State, *this, getSValBuilder(), F, Sym,
+ Range);
}
//===------------------------------------------------------------------------===
More information about the cfe-commits
mailing list