[analyzer] dynamic_cast Simplify null value generation.
As per Jordy's review. Creating a symbol here is more flexible; however I could not come up with an example where it was needed. (What constrains can be added on of the symbol constrained to 0?) llvm-svn: 154542
This commit is contained in:
parent
1a3a247041
commit
f36a6f54ae
|
|
@ -310,14 +310,8 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
|
||||||
Bldr.generateNode(CastE, Pred, state, true);
|
Bldr.generateNode(CastE, Pred, state, true);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
// If the cast fails on a pointer, conjure symbol constrained to 0.
|
// If the cast fails on a pointer, bind to 0.
|
||||||
DefinedOrUnknownSVal NewSym = svalBuilder.getConjuredSymbolVal(NULL,
|
state = state->BindExpr(CastE, LCtx, svalBuilder.makeNull());
|
||||||
CastE, LCtx, resultType,
|
|
||||||
currentBuilderContext->getCurrentBlockCount());
|
|
||||||
DefinedOrUnknownSVal Constraint = svalBuilder.evalEQ(state,
|
|
||||||
NewSym, svalBuilder.makeZeroVal(resultType));
|
|
||||||
state = state->assume(Constraint, true);
|
|
||||||
state = state->BindExpr(CastE, LCtx, NewSym);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If we don't know if the cast succeeded, conjure a new symbol.
|
// If we don't know if the cast succeeded, conjure a new symbol.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue