From 4e9c0854382d37325771b50f6cf899a75119fa24 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 25 Feb 2013 07:37:13 +0000 Subject: [analyzer] add the notion of an "interesting" lvalue expression for ExplodedNode pruning. r175988 modified the ExplodedGraph trimming algorithm to retain all nodes for "lvalue" expressions. This patch refines that notion to only "interesting" expressions that would be used for diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176010 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/StaticAnalyzer/Core/ExplodedGraph.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'lib/StaticAnalyzer/Core/ExplodedGraph.cpp') diff --git a/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/lib/StaticAnalyzer/Core/ExplodedGraph.cpp index 443d87076a..02268c410a 100644 --- a/lib/StaticAnalyzer/Core/ExplodedGraph.cpp +++ b/lib/StaticAnalyzer/Core/ExplodedGraph.cpp @@ -56,6 +56,14 @@ ExplodedGraph::~ExplodedGraph() {} // Node reclamation. //===----------------------------------------------------------------------===// +bool ExplodedGraph::isInterestingLValueExpr(const Expr *Ex) { + if (!Ex->isLValue()) + return false; + return isa(Ex) || + isa(Ex) || + isa(Ex); +} + bool ExplodedGraph::shouldCollect(const ExplodedNode *node) { // Reclaim all nodes that match *all* the following criteria: // @@ -101,11 +109,15 @@ bool ExplodedGraph::shouldCollect(const ExplodedNode *node) { progPoint.getLocationContext() != pred->getLocationContext()) return false; + // All further checks require expressions. + const Expr *Ex = dyn_cast(ps.getStmt()); + if (!Ex) + return false; + // Condition 8. - // Do not collect nodes for lvalue expressions since they are + // Do not collect nodes for "interesting" lvalue expressions since they are // used extensively for generating path diagnostics. - const Expr *Ex = dyn_cast(ps.getStmt()); - if (!Ex || Ex->isLValue()) + if (isInterestingLValueExpr(Ex)) return false; // Condition 9. -- cgit v1.2.3