mirror of https://github.com/microsoft/clang.git
[analyzer] Dump a reproducible, deterministic ID of program state to exploded graph
Differential Revision: https://reviews.llvm.org/D51395 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341600 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cdacbfee79
commit
cc7b7584b5
|
@ -107,6 +107,8 @@ public:
|
||||||
|
|
||||||
~ProgramState();
|
~ProgramState();
|
||||||
|
|
||||||
|
int64_t getID() const;
|
||||||
|
|
||||||
/// Return the ProgramStateManager associated with this state.
|
/// Return the ProgramStateManager associated with this state.
|
||||||
ProgramStateManager &getStateManager() const {
|
ProgramStateManager &getStateManager() const {
|
||||||
return *stateMgr;
|
return *stateMgr;
|
||||||
|
|
|
@ -3141,7 +3141,8 @@ struct DOTGraphTraits<ExplodedNode*> : public DefaultDOTGraphTraits {
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgramStateRef state = N->getState();
|
ProgramStateRef state = N->getState();
|
||||||
Out << "\\|StateID: " << (const void*) state.get()
|
Out << "\\|StateID: " << state->getID() << " ("
|
||||||
|
<< (const void*) state.get() << ")"
|
||||||
<< " NodeID: " << (const void*) N << "\\|";
|
<< " NodeID: " << (const void*) N << "\\|";
|
||||||
|
|
||||||
state->printDOT(Out, N->getLocationContext());
|
state->printDOT(Out, N->getLocationContext());
|
||||||
|
|
|
@ -69,6 +69,13 @@ ProgramState::~ProgramState() {
|
||||||
stateMgr->getStoreManager().decrementReferenceCount(store);
|
stateMgr->getStoreManager().decrementReferenceCount(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t ProgramState::getID() const {
|
||||||
|
Optional<int64_t> Out = getStateManager().Alloc.identifyObject(this);
|
||||||
|
assert(Out && "Wrong allocator used");
|
||||||
|
assert(*Out % alignof(ProgramState) == 0 && "Wrong alignment information");
|
||||||
|
return *Out / alignof(ProgramState);
|
||||||
|
}
|
||||||
|
|
||||||
ProgramStateManager::ProgramStateManager(ASTContext &Ctx,
|
ProgramStateManager::ProgramStateManager(ASTContext &Ctx,
|
||||||
StoreManagerCreator CreateSMgr,
|
StoreManagerCreator CreateSMgr,
|
||||||
ConstraintManagerCreator CreateCMgr,
|
ConstraintManagerCreator CreateCMgr,
|
||||||
|
|
Loading…
Reference in New Issue