aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core
diff options
context:
space:
mode:
Diffstat (limited to 'lib/StaticAnalyzer/Core')
-rw-r--r--lib/StaticAnalyzer/Core/BugReporterVisitors.cpp2
-rw-r--r--lib/StaticAnalyzer/Core/ExplodedGraph.cpp18
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index cb716a3154..5e3daff9a4 100644
--- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -663,7 +663,7 @@ bool bugreporter::trackNullOrUndefValue(const ExplodedNode *N, const Stmt *S,
// or function call inside.
Ex = Ex->IgnoreParenCasts();
- if (Ex->isLValue()) {
+ if (ExplodedGraph::isInterestingLValueExpr(Ex)) {
const MemRegion *R = 0;
// First check if this is a DeclRefExpr for a C++ reference type.
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<DeclRefExpr>(Ex) ||
+ isa<MemberExpr>(Ex) ||
+ isa<ObjCIvarRefExpr>(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<Expr>(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<Expr>(ps.getStmt());
- if (!Ex || Ex->isLValue())
+ if (isInterestingLValueExpr(Ex))
return false;
// Condition 9.