From f36a6f54aef44bc8fceb84ea0ca01ffc08945365 Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Wed, 11 Apr 2012 22:20:07 +0000 Subject: [PATCH] [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 --- clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp index 57efd463aec2..93e598a27375 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp @@ -310,14 +310,8 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex, Bldr.generateNode(CastE, Pred, state, true); continue; } else { - // If the cast fails on a pointer, conjure symbol constrained to 0. - DefinedOrUnknownSVal NewSym = svalBuilder.getConjuredSymbolVal(NULL, - 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); + // If the cast fails on a pointer, bind to 0. + state = state->BindExpr(CastE, LCtx, svalBuilder.makeNull()); } } else { // If we don't know if the cast succeeded, conjure a new symbol.