r341602 - [analyzer] Dump stable identifiers for exploded nodes
George Karpenkov via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 6 16:08:07 PDT 2018
Author: george.karpenkov
Date: Thu Sep 6 16:08:07 2018
New Revision: 341602
URL: http://llvm.org/viewvc/llvm-project?rev=341602&view=rev
Log:
[analyzer] Dump stable identifiers for exploded nodes
Differential Revision: https://reviews.llvm.org/D51667
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h?rev=341602&r1=341601&r2=341602&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h Thu Sep 6 16:08:07 2018
@@ -240,6 +240,8 @@ public:
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); }
Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp?rev=341602&r1=341601&r2=341602&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp Thu Sep 6 16:08:07 2018
@@ -283,6 +283,13 @@ ExplodedNode * const *ExplodedNode::Node
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,
Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=341602&r1=341601&r2=341602&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Thu Sep 6 16:08:07 2018
@@ -3141,9 +3141,13 @@ struct DOTGraphTraits<ExplodedNode*> : p
}
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());
More information about the cfe-commits
mailing list