aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-30 05:51:50 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-30 05:51:50 +0000
commit9f246b6bca9f9070095abe6b9e3604df3a3adc67 (patch)
treecd1cb1c32b73b08ff02a762fd87f1e2ba9e031c2 /lib/Analysis/CFRefCount.cpp
parent76a50e32581cde9f9b288a8086acaf0ac0019dcd (diff)
Handle case in EvalReturn where we cache out in the ExplodedGraph.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70475 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r--lib/Analysis/CFRefCount.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 1dc52c797c..eb7d04a342 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -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);
+ }
}
}
}