Patch to remove a recursive visitiation in ExprEngine that is no longer needed because the CFG is fully linearized.

-- Erik.
>From f0f6969b2c24afd6b861bbaa9ba8adcee618faec Mon Sep 17 00:00:00 2001
From: Erik Verbruggen <[email protected]>
Date: Tue, 28 Feb 2012 10:18:46 +0100
Subject: [PATCH] Remove a recursive visitiation in ExprEngine that is no
 longer needed because the CFG is fully linearized.

---
 lib/StaticAnalyzer/Core/ExprEngineCXX.cpp |   12 +++---------
 test/Analysis/nullptr.cpp                 |    5 ++++-
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp 
b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
index 45f8cee..fa02451 100644
--- a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
@@ -335,15 +335,9 @@ void ExprEngine::VisitCXXNewExpr(const CXXNewExpr *CNE, 
ExplodedNode *Pred,
 
 void ExprEngine::VisitCXXDeleteExpr(const CXXDeleteExpr *CDE, 
                                     ExplodedNode *Pred, ExplodedNodeSet &Dst) {
-  // Should do more checking.
-  ExplodedNodeSet Argevaluated;
-  Visit(CDE->getArgument(), Pred, Argevaluated);
-  StmtNodeBuilder Bldr(Argevaluated, Dst, *currentBuilderContext);
-  for (ExplodedNodeSet::iterator I = Argevaluated.begin(), 
-                                 E = Argevaluated.end(); I != E; ++I) {
-    ProgramStateRef state = (*I)->getState();
-    Bldr.generateNode(CDE, *I, state);
-  }
+  StmtNodeBuilder Bldr(Pred, Dst, *currentBuilderContext);
+  ProgramStateRef state = Pred->getState();
+  Bldr.generateNode(CDE, Pred, state);
 }
 
 void ExprEngine::VisitCXXThisExpr(const CXXThisExpr *TE, ExplodedNode *Pred,
diff --git a/test/Analysis/nullptr.cpp b/test/Analysis/nullptr.cpp
index fc7e7ef..89b4173 100644
--- a/test/Analysis/nullptr.cpp
+++ b/test/Analysis/nullptr.cpp
@@ -39,7 +39,6 @@ void foo4(void) {
     *np = 0;  // no-warning
 }
 
-
 int pr10372(void *& x) {
   // GNU null is a pointer-sized integer, not a pointer.
   x = __null;
@@ -47,3 +46,7 @@ int pr10372(void *& x) {
   return __null;
 }
 
+void zoo1() {
+  char **p = 0;
+  delete *(p + 0); // expected-warning{{Dereference of null pointer}}
+}
-- 
1.7.5.4

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to