forked from OSchip/llvm-project
[analyzer] Make ProgramStateManager's SubEngine parameter optional.
It is possible and valid to have a state manager and associated objects without having a SubEngine or checkers. Patch by Olaf Krzikalla! llvm-svn: 164947
This commit is contained in:
parent
d756f06063
commit
d63f04d8a7
|
@ -118,7 +118,7 @@ protected:
|
|||
};
|
||||
|
||||
ConstraintManager* CreateRangeConstraintManager(ProgramStateManager& statemgr,
|
||||
SubEngine &subengine);
|
||||
SubEngine *subengine);
|
||||
|
||||
} // end GR namespace
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class CallEvent;
|
|||
class CallEventManager;
|
||||
|
||||
typedef ConstraintManager* (*ConstraintManagerCreator)(ProgramStateManager&,
|
||||
SubEngine&);
|
||||
SubEngine*);
|
||||
typedef StoreManager* (*StoreManagerCreator)(ProgramStateManager&);
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -447,7 +447,7 @@ public:
|
|||
StoreManagerCreator CreateStoreManager,
|
||||
ConstraintManagerCreator CreateConstraintManager,
|
||||
llvm::BumpPtrAllocator& alloc,
|
||||
SubEngine &subeng);
|
||||
SubEngine *subeng);
|
||||
|
||||
~ProgramStateManager();
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ ExprEngine::ExprEngine(AnalysisManager &mgr, bool gcEnabled,
|
|||
G(Engine.getGraph()),
|
||||
StateMgr(getContext(), mgr.getStoreManagerCreator(),
|
||||
mgr.getConstraintManagerCreator(), G.getAllocator(),
|
||||
*this),
|
||||
this),
|
||||
SymMgr(StateMgr.getSymbolManager()),
|
||||
svalBuilder(StateMgr.getSValBuilder()),
|
||||
EntryNode(NULL),
|
||||
|
|
|
@ -71,8 +71,8 @@ ProgramStateManager::ProgramStateManager(ASTContext &Ctx,
|
|||
StoreManagerCreator CreateSMgr,
|
||||
ConstraintManagerCreator CreateCMgr,
|
||||
llvm::BumpPtrAllocator &alloc,
|
||||
SubEngine &SubEng)
|
||||
: Eng(&SubEng), EnvMgr(alloc), GDMFactory(alloc),
|
||||
SubEngine *SubEng)
|
||||
: Eng(SubEng), EnvMgr(alloc), GDMFactory(alloc),
|
||||
svalBuilder(createSimpleSValBuilder(alloc, Ctx, *this)),
|
||||
CallEventMgr(new CallEventManager(alloc)), Alloc(alloc) {
|
||||
StoreMgr.reset((*CreateSMgr)(*this));
|
||||
|
|
|
@ -296,7 +296,7 @@ namespace {
|
|||
class RangeConstraintManager : public SimpleConstraintManager{
|
||||
RangeSet GetRange(ProgramStateRef state, SymbolRef sym);
|
||||
public:
|
||||
RangeConstraintManager(SubEngine &subengine, BasicValueFactory &BVF)
|
||||
RangeConstraintManager(SubEngine *subengine, BasicValueFactory &BVF)
|
||||
: SimpleConstraintManager(subengine, BVF) {}
|
||||
|
||||
ProgramStateRef assumeSymNE(ProgramStateRef state, SymbolRef sym,
|
||||
|
@ -337,7 +337,7 @@ private:
|
|||
} // end anonymous namespace
|
||||
|
||||
ConstraintManager *
|
||||
ento::CreateRangeConstraintManager(ProgramStateManager &StMgr, SubEngine &Eng) {
|
||||
ento::CreateRangeConstraintManager(ProgramStateManager &StMgr, SubEngine *Eng) {
|
||||
return new RangeConstraintManager(Eng, StMgr.getBasicVals());
|
||||
}
|
||||
|
||||
|
|
|
@ -67,8 +67,8 @@ ProgramStateRef SimpleConstraintManager::assume(ProgramStateRef state,
|
|||
ProgramStateRef SimpleConstraintManager::assume(ProgramStateRef state, Loc cond,
|
||||
bool assumption) {
|
||||
state = assumeAux(state, cond, assumption);
|
||||
if (NotifyAssumeClients)
|
||||
return SU.processAssume(state, cond, assumption);
|
||||
if (NotifyAssumeClients && SU)
|
||||
return SU->processAssume(state, cond, assumption);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -115,8 +115,8 @@ ProgramStateRef SimpleConstraintManager::assume(ProgramStateRef state,
|
|||
NonLoc cond,
|
||||
bool assumption) {
|
||||
state = assumeAux(state, cond, assumption);
|
||||
if (NotifyAssumeClients)
|
||||
return SU.processAssume(state, cond, assumption);
|
||||
if (NotifyAssumeClients && SU)
|
||||
return SU->processAssume(state, cond, assumption);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@ namespace clang {
|
|||
namespace ento {
|
||||
|
||||
class SimpleConstraintManager : public ConstraintManager {
|
||||
SubEngine &SU;
|
||||
SubEngine *SU;
|
||||
BasicValueFactory &BVF;
|
||||
public:
|
||||
SimpleConstraintManager(SubEngine &subengine, BasicValueFactory &BV)
|
||||
SimpleConstraintManager(SubEngine *subengine, BasicValueFactory &BV)
|
||||
: SU(subengine), BVF(BV) {}
|
||||
virtual ~SimpleConstraintManager();
|
||||
|
||||
|
|
Loading…
Reference in New Issue