From 46a54eb500aa1f841308ad78ef356d28b1bbb0cc Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 7 May 2009 00:45:08 +0000 Subject: [PATCH] Bug fix: Not all ConstraintManagers always return a null state when setting 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 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h index 1a165fd698..37af0caadf 100644 --- a/include/clang/Analysis/PathSensitive/GRState.h +++ b/include/clang/Analysis/PathSensitive/GRState.h @@ -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) { -- 2.40.0