]> granicus.if.org Git - clang/commitdiff
Bug fix: Not all ConstraintManagers always return a null state when setting
authorTed Kremenek <kremenek@apple.com>
Thu, 7 May 2009 00:45:08 +0000 (00:45 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 7 May 2009 00:45:08 +0000 (00:45 +0000)
isFeasible to false. This is something we may wish to do further validation on.

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

include/clang/Analysis/PathSensitive/GRState.h

index 1a165fd69889ec344f87e2761cb112a0a1fdfaf7..37af0caadf336793036ee3c12767eaf7c04a3d84 100644 (file)
@@ -641,13 +641,19 @@ public:
 
   const GRState* Assume(const GRState* St, SVal Cond, bool Assumption,
                            bool& isFeasible) {
-    return ConstraintMgr->Assume(St, Cond, Assumption, isFeasible);
+    const GRState *state =
+      ConstraintMgr->Assume(St, Cond, Assumption, isFeasible);
+    assert(!isFeasible || state);
+    return isFeasible ? state : NULL;
   }
 
   const GRState* AssumeInBound(const GRState* St, SVal Idx, SVal UpperBound,
                                bool Assumption, bool& isFeasible) {
-    return ConstraintMgr->AssumeInBound(St, Idx, UpperBound, Assumption, 
-                                        isFeasible);
+    const GRState *state =
+      ConstraintMgr->AssumeInBound(St, Idx, UpperBound, Assumption, 
+                                   isFeasible);
+    assert(!isFeasible || state);
+    return isFeasible ? state : NULL;
   }
 
   const llvm::APSInt* getSymVal(const GRState* St, SymbolRef sym) {