From 40cbde9ce28af51a8a1124d3a6f6b1477a6efce8 Mon Sep 17 00:00:00 2001 From: George Karpenkov Date: Sat, 15 Sep 2018 02:01:26 +0000 Subject: [PATCH] [analyzer] Skip printing duplicate nodes, even if nodes have multiple predecessors/successors Still generate a node, but leave the redundant field empty. Differential Revision: https://reviews.llvm.org/D51821 llvm-svn: 342308 --- clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 638fc5d..a1fcd12 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -3177,7 +3177,12 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { << ")" << " NodeID: " << N->getID(&Graph) << " (" << (const void *)N << ")\\|"; - State->printDOT(Out, N->getLocationContext()); + bool SameAsAllPredecessors = + std::all_of(N->pred_begin(), N->pred_end(), [&](const ExplodedNode *P) { + return P->getState() == State; + }); + if (!SameAsAllPredecessors) + State->printDOT(Out, N->getLocationContext()); return Out.str(); } }; -- 2.7.4