r342308 - [analyzer] Skip printing duplicate nodes, even if nodes have multiple predecessors/successors

George Karpenkov via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 14 19:01:26 PDT 2018


Author: george.karpenkov
Date: Fri Sep 14 19:01:26 2018
New Revision: 342308

URL: http://llvm.org/viewvc/llvm-project?rev=342308&view=rev
Log:
[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

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=342308&r1=342307&r2=342308&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Fri Sep 14 19:01:26 2018
@@ -3177,7 +3177,12 @@ struct DOTGraphTraits<ExplodedNode*> : p
         << ")"
         << " 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();
   }
 };




More information about the cfe-commits mailing list