]> granicus.if.org Git - clang/commitdiff
[analyzer] dynamic_cast Simplify null value generation.
authorAnna Zaks <ganna@apple.com>
Wed, 11 Apr 2012 22:20:07 +0000 (22:20 +0000)
committerAnna Zaks <ganna@apple.com>
Wed, 11 Apr 2012 22:20:07 +0000 (22:20 +0000)
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?)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154542 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/ExprEngineC.cpp

index 57efd463aec232d64c81bae7035dad7c3ecf0890..93e598a273756a2cc0536d8d0e9b0ab3d6c81cb8 100644 (file)
@@ -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.