forked from OSchip/llvm-project
Handle case in EvalReturn where we cache out in the ExplodedGraph.
llvm-svn: 70475
This commit is contained in:
parent
497df9126f
commit
b4e27a1838
|
@ -3008,6 +3008,10 @@ void CFRefCount::EvalReturn(ExplodedNodeSet<GRState>& Dst,
|
||||||
state = state.set<RefBindings>(Sym, X);
|
state = state.set<RefBindings>(Sym, X);
|
||||||
Pred = Builder.MakeNode(Dst, S, Pred, state);
|
Pred = Builder.MakeNode(Dst, S, Pred, state);
|
||||||
|
|
||||||
|
// Did we cache out?
|
||||||
|
if (!Pred)
|
||||||
|
return;
|
||||||
|
|
||||||
// Any leaks or other errors?
|
// Any leaks or other errors?
|
||||||
if (X.isReturnedOwned() && X.getCount() == 0) {
|
if (X.isReturnedOwned() && X.getCount() == 0) {
|
||||||
const Decl *CD = &Eng.getStateManager().getCodeDecl();
|
const Decl *CD = &Eng.getStateManager().getCodeDecl();
|
||||||
|
@ -3018,13 +3022,13 @@ void CFRefCount::EvalReturn(ExplodedNodeSet<GRState>& Dst,
|
||||||
static int ReturnOwnLeakTag = 0;
|
static int ReturnOwnLeakTag = 0;
|
||||||
state = state.set<RefBindings>(Sym, X ^ RefVal::ErrorLeakReturned);
|
state = state.set<RefBindings>(Sym, X ^ RefVal::ErrorLeakReturned);
|
||||||
// Generate an error node.
|
// Generate an error node.
|
||||||
ExplodedNode<GRState> *N =
|
if (ExplodedNode<GRState> *N =
|
||||||
Builder.generateNode(PostStmt(S, &ReturnOwnLeakTag), state, Pred);
|
Builder.generateNode(PostStmt(S, &ReturnOwnLeakTag), state, Pred)) {
|
||||||
|
CFRefLeakReport *report =
|
||||||
CFRefLeakReport *report =
|
new CFRefLeakReport(*static_cast<CFRefBug*>(leakAtReturn), *this,
|
||||||
new CFRefLeakReport(*static_cast<CFRefBug*>(leakAtReturn), *this,
|
N, Sym, Eng);
|
||||||
N, Sym, Eng);
|
BR->EmitReport(report);
|
||||||
BR->EmitReport(report);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue