Handle case in EvalReturn where we cache out in the ExplodedGraph.

llvm-svn: 70475
This commit is contained in:
Ted Kremenek 2009-04-30 05:51:50 +00:00
parent 497df9126f
commit b4e27a1838
1 changed files with 11 additions and 7 deletions

View 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,9 +3022,8 @@ 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);
if (ExplodedNode<GRState> *N =
Builder.generateNode(PostStmt(S, &ReturnOwnLeakTag), state, Pred)) {
CFRefLeakReport *report =
new CFRefLeakReport(*static_cast<CFRefBug*>(leakAtReturn), *this,
N, Sym, Eng);
@ -3028,6 +3031,7 @@ void CFRefCount::EvalReturn(ExplodedNodeSet<GRState>& Dst,
}
}
}
}
}
// Assumptions.