mirror of
https://github.com/intel/llvm.git
synced 2026-02-03 02:26:27 +08:00
[analyzer] Dump a reproducible, deterministic ID of program state to exploded graph
Differential Revision: https://reviews.llvm.org/D51395 llvm-svn: 341600
This commit is contained in:
@@ -107,6 +107,8 @@ public:
|
||||
|
||||
~ProgramState();
|
||||
|
||||
int64_t getID() const;
|
||||
|
||||
/// Return the ProgramStateManager associated with this state.
|
||||
ProgramStateManager &getStateManager() const {
|
||||
return *stateMgr;
|
||||
|
||||
@@ -3141,7 +3141,8 @@ struct DOTGraphTraits<ExplodedNode*> : public DefaultDOTGraphTraits {
|
||||
}
|
||||
|
||||
ProgramStateRef state = N->getState();
|
||||
Out << "\\|StateID: " << (const void*) state.get()
|
||||
Out << "\\|StateID: " << state->getID() << " ("
|
||||
<< (const void*) state.get() << ")"
|
||||
<< " NodeID: " << (const void*) N << "\\|";
|
||||
|
||||
state->printDOT(Out, N->getLocationContext());
|
||||
|
||||
@@ -69,6 +69,13 @@ ProgramState::~ProgramState() {
|
||||
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,
|
||||
StoreManagerCreator CreateSMgr,
|
||||
ConstraintManagerCreator CreateCMgr,
|
||||
|
||||
Reference in New Issue
Block a user