ConstraintManager::AssumeDual now accepts a 'DefinedSVal' instead of 'SVal' for
the condition. This eliminates a source of bugs where the client doesn't
correctly reason about undefined or unknown values. This fixes PR 4759.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79952 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/GRExprEngineInternalChecks.cpp b/lib/Analysis/GRExprEngineInternalChecks.cpp
index d22f276..1b2fd1c 100644
--- a/lib/Analysis/GRExprEngineInternalChecks.cpp
+++ b/lib/Analysis/GRExprEngineInternalChecks.cpp
@@ -575,10 +575,15 @@
       if (!Att->isNonNull(idx))
         continue;
       
+      const SVal &V = state->getSVal(*I);
+      const DefinedSVal *DV = dyn_cast<DefinedSVal>(&V);
+      
+      if (!DV)
+        continue;
+      
       ConstraintManager &CM = C.getConstraintManager();
       const GRState *stateNotNull, *stateNull;
-      llvm::tie(stateNotNull, stateNull) = CM.AssumeDual(state,
-                                                         state->getSVal(*I));
+      llvm::tie(stateNotNull, stateNull) = CM.AssumeDual(state, *DV);
       
       if (stateNull && !stateNotNull) {
         // Generate an error node.  Check for a null node in case