summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h2
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp7
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExprEngine.cpp10
3 files changed, 16 insertions, 3 deletions
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
index f974ef821d7..29754c163ac 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
@@ -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); }
diff --git a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
index 68e47af1086..66944c616b9 100644
--- a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
@@ -283,6 +283,13 @@ ExplodedNode * const *ExplodedNode::NodeGroup::end() const {
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,
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index a9901a6cd7d..7f13c7f0a05 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -3141,9 +3141,13 @@ struct DOTGraphTraits<ExplodedNode*> : public DefaultDOTGraphTraits {
}
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());
OpenPOWER on IntegriCloud