[PATCH] D51395: [analyzer] Dump a reproducible, deterministic ID of program state to exploded graph
George Karpenkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 6 16:08:46 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL341600: [analyzer] Dump a reproducible, deterministic ID of program state to exploded… (authored by george.karpenkov, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D51395?vs=163247&id=164310#toc
Repository:
rL LLVM
https://reviews.llvm.org/D51395
Files:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp
Index: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -3141,7 +3141,8 @@
}
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());
Index: cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp
@@ -69,6 +69,13 @@
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,
Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
===================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
@@ -107,6 +107,8 @@
~ProgramState();
+ int64_t getID() const;
+
/// Return the ProgramStateManager associated with this state.
ProgramStateManager &getStateManager() const {
return *stateMgr;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51395.164310.patch
Type: text/x-patch
Size: 1894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180906/0ce8f8c7/attachment.bin>
More information about the llvm-commits
mailing list