[cfe-commits] r70475 - /cfe/trunk/lib/Analysis/CFRefCount.cpp

Ted Kremenek kremenek at apple.com
Wed Apr 29 22:51:50 PDT 2009


Author: kremenek
Date: Thu Apr 30 00:51:50 2009
New Revision: 70475

URL: http://llvm.org/viewvc/llvm-project?rev=70475&view=rev
Log:
Handle case in EvalReturn where we cache out in the ExplodedGraph.

Modified:
    cfe/trunk/lib/Analysis/CFRefCount.cpp

Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=70475&r1=70474&r2=70475&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Thu Apr 30 00:51:50 2009
@@ -3008,6 +3008,10 @@
   state = state.set<RefBindings>(Sym, X);
   Pred = Builder.MakeNode(Dst, S, Pred, state);
   
+  // Did we cache out?
+  if (!Pred)
+    return;
+  
   // Any leaks or other errors?
   if (X.isReturnedOwned() && X.getCount() == 0) {
     const Decl *CD = &Eng.getStateManager().getCodeDecl();
@@ -3018,13 +3022,13 @@
         static int ReturnOwnLeakTag = 0;
         state = state.set<RefBindings>(Sym, X ^ RefVal::ErrorLeakReturned);
         // Generate an error node.
-        ExplodedNode<GRState> *N =
-          Builder.generateNode(PostStmt(S, &ReturnOwnLeakTag), state, Pred);
-        
-        CFRefLeakReport *report =
-          new CFRefLeakReport(*static_cast<CFRefBug*>(leakAtReturn), *this,
-                              N, Sym, Eng);
-        BR->EmitReport(report);
+        if (ExplodedNode<GRState> *N =
+            Builder.generateNode(PostStmt(S, &ReturnOwnLeakTag), state, Pred)) {
+          CFRefLeakReport *report =
+            new CFRefLeakReport(*static_cast<CFRefBug*>(leakAtReturn), *this,
+                                N, Sym, Eng);
+          BR->EmitReport(report);
+        }
       }
     }
   }





More information about the cfe-commits mailing list