]> granicus.if.org Git - clang/commitdiff
Handle case in EvalReturn where we cache out in the ExplodedGraph.
authorTed Kremenek <kremenek@apple.com>
Thu, 30 Apr 2009 05:51:50 +0000 (05:51 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 30 Apr 2009 05:51:50 +0000 (05:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70475 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFRefCount.cpp

index 1dc52c797c864ea6107330d8f9228665f11dfa59..eb7d04a3425392fbaca5260624d0cc28e7ea9c98 100644 (file)
@@ -3008,6 +3008,10 @@ void CFRefCount::EvalReturn(ExplodedNodeSet<GRState>& Dst,
   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 @@ void CFRefCount::EvalReturn(ExplodedNodeSet<GRState>& Dst,
         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);
+        }
       }
     }
   }