[PATCH] D51667: [analyzer] Dump stable identifiers for exploded nodes
George Karpenkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 6 16:09:28 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL341602: [analyzer] Dump stable identifiers for exploded nodes (authored by george.karpenkov, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D51667?vs=164308&id=164312#toc
Repository:
rL LLVM
https://reviews.llvm.org/D51667
Files:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
Index: cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
@@ -283,6 +283,13 @@
return Storage.getAddrOfPtr1() + 1;
}
+int64_t ExplodedNode::getID(ExplodedGraph *G) const {
+ Optional<int64_t> Out = G->getAllocator().identifyObject(this);
+ assert(Out && "Wrong allocator used");
+ assert(*Out % alignof(ExplodedNode) == 0 && "Wrong alignment information");
+ return *Out / alignof(ExplodedNode);
+}
+
ExplodedNode *ExplodedGraph::getNode(const ProgramPoint &L,
ProgramStateRef State,
bool IsSink,
Index: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -3141,9 +3141,13 @@
}
ProgramStateRef state = N->getState();
- Out << "\\|StateID: " << state->getID() << " ("
- << (const void*) state.get() << ")"
- << " NodeID: " << (const void*) N << "\\|";
+ ExplodedGraph &Graph =
+ static_cast<ExprEngine *>(state->getStateManager().getOwningEngine())
+ ->getGraph();
+
+ Out << "\\|StateID: " << state->getID() << " (" << (const void *)state.get()
+ << ")"
+ << " NodeID: " << N->getID(&Graph) << " (" << (const void *)N << ")\\|";
state->printDOT(Out, N->getLocationContext());
Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
===================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
@@ -240,6 +240,8 @@
return const_cast<ExplodedNode*>(this)->succ_end();
}
+ int64_t getID(ExplodedGraph *G) const;
+
private:
void replaceSuccessor(ExplodedNode *node) { Succs.replaceNode(node); }
void replacePredecessor(ExplodedNode *node) { Preds.replaceNode(node); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51667.164312.patch
Type: text/x-patch
Size: 2187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180906/2d9e5ba3/attachment.bin>
More information about the llvm-commits
mailing list