[cfe-commits] r151711 - in /cfe/trunk: lib/StaticAnalyzer/Core/ExprEngineCXX.cpp test/Analysis/nullptr.cpp

Erik Verbruggen erikjv at me.com
Wed Feb 29 00:42:57 PST 2012


Author: erikjv
Date: Wed Feb 29 02:42:57 2012
New Revision: 151711

URL: http://llvm.org/viewvc/llvm-project?rev=151711&view=rev
Log:
Remove a recursive visitiation in ExprEngine that is no longer needed
because the CFG is fully linearized.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
    cfe/trunk/test/Analysis/nullptr.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp?rev=151711&r1=151710&r2=151711&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp Wed Feb 29 02:42:57 2012
@@ -335,15 +335,9 @@
 
 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,

Modified: cfe/trunk/test/Analysis/nullptr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/nullptr.cpp?rev=151711&r1=151710&r2=151711&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/nullptr.cpp (original)
+++ cfe/trunk/test/Analysis/nullptr.cpp Wed Feb 29 02:42:57 2012
@@ -39,7 +39,6 @@
     *np = 0;  // no-warning
 }
 
-
 int pr10372(void *& x) {
   // GNU null is a pointer-sized integer, not a pointer.
   x = __null;
@@ -47,3 +46,7 @@
   return __null;
 }
 
+void zoo1() {
+  char **p = 0;
+  delete *(p + 0); // expected-warning{{Dereference of null pointer}}
+}





More information about the cfe-commits mailing list