[cfe-commits] r154542 - /cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp

Anna Zaks ganna at apple.com
Wed Apr 11 15:20:08 PDT 2012


Author: zaks
Date: Wed Apr 11 17:20:07 2012
New Revision: 154542

URL: http://llvm.org/viewvc/llvm-project?rev=154542&view=rev
Log:
[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?)

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp?rev=154542&r1=154541&r2=154542&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp Wed Apr 11 17:20:07 2012
@@ -310,14 +310,8 @@
             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.





More information about the cfe-commits mailing list