summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2019-07-03 01:26:41 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2019-07-03 01:26:41 +0000
commitab758ba128c46ba30cad058b89991852f7be5543 (patch)
tree9ceddcacadb0e85e686a38615c764ef065fa6398 /clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
parent5fcf92e153806e8fb3f195104f3d057580236132 (diff)
downloadbcm5719-llvm-ab758ba128c46ba30cad058b89991852f7be5543.tar.gz
bcm5719-llvm-ab758ba128c46ba30cad058b89991852f7be5543.zip
[analyzer] exploded-graph-rewriter: Implement bug nodes and sink nodes.
Add a label to nodes that have a bug report attached or on which the analysis was generally interrupted. Fix printing has_report and implement printing is_sink in the graph dumper. Differential Revision: https://reviews.llvm.org/D64110 llvm-svn: 364992
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngine.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExprEngine.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index d95fb314f3c..12094c6a1e6 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -3006,7 +3006,8 @@ struct DOTGraphTraits<ExplodedGraph*> : public DefaultDOTGraphTraits {
for (const auto &EQ : EQClasses) {
for (const BugReport &Report : EQ) {
- if (Report.getErrorNode()->getState() == N->getState())
+ if (Report.getErrorNode()->getState() == N->getState() &&
+ Report.getErrorNode()->getLocation() == N->getLocation())
return true;
}
}
@@ -3042,21 +3043,6 @@ struct DOTGraphTraits<ExplodedGraph*> : public DefaultDOTGraphTraits {
return false;
}
- static std::string getNodeAttributes(const ExplodedNode *N,
- ExplodedGraph *) {
- SmallVector<StringRef, 10> Out;
- auto Noop = [](const ExplodedNode*){};
- if (traverseHiddenNodes(N, Noop, Noop, &nodeHasBugReport)) {
- Out.push_back("style=filled");
- Out.push_back("fillcolor=red");
- }
-
- if (traverseHiddenNodes(N, Noop, Noop,
- [](const ExplodedNode *C) { return C->isSink(); }))
- Out.push_back("color=blue");
- return llvm::join(Out, ",");
- }
-
static bool isNodeHidden(const ExplodedNode *N) {
return N->isTrivial();
}
@@ -3069,9 +3055,16 @@ struct DOTGraphTraits<ExplodedGraph*> : public DefaultDOTGraphTraits {
const unsigned int Space = 1;
ProgramStateRef State = N->getState();
+ auto Noop = [](const ExplodedNode*){};
+ bool HasReport = traverseHiddenNodes(
+ N, Noop, Noop, &nodeHasBugReport);
+ bool IsSink = traverseHiddenNodes(
+ N, Noop, Noop, [](const ExplodedNode *N) { return N->isSink(); });
+
Out << "{ \"node_id\": " << N->getID(G) << ", \"pointer\": \""
<< (const void *)N << "\", \"state_id\": " << State->getID()
- << ", \"has_report\": " << (nodeHasBugReport(N) ? "true" : "false")
+ << ", \"has_report\": " << (HasReport ? "true" : "false")
+ << ", \"is_sink\": " << (IsSink ? "true" : "false")
<< ",\\l";
Indent(Out, Space, IsDot) << "\"program_points\": [\\l";
OpenPOWER on IntegriCloud