From: Ted Kremenek Date: Wed, 11 Mar 2009 02:24:48 +0000 (+0000) Subject: GRExprEngine: For places we might conjure up a new symbol to recover X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=276c6aca0e9cd2bbd5533493612f67767544d839;p=clang GRExprEngine: For places we might conjure up a new symbol to recover path-sensitivity, beyond checking to see if the value is "unknown" also check if the ConstraintManager can handle the SVal. This allows us to recover some path-sensitivity by actually discarding some information. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66627 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index 222ef173e8..8bc84d4bf5 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -1978,7 +1978,8 @@ void GRExprEngine::VisitDeclStmt(DeclStmt* DS, NodeTy* Pred, NodeSet& Dst) { // Recover some path-sensitivity if a scalar value evaluated to // UnknownVal. - if (InitVal.isUnknown()) { + if (InitVal.isUnknown() || + !getConstraintManager().canReasonAbout(InitVal)) { if (Loc::IsLocType(T)) { SymbolRef Sym = SymMgr.getConjuredSymbol(InitEx, Count); InitVal = loc::SymbolVal(Sym); @@ -2593,8 +2594,10 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, // FIXME: Handle structs. QualType T = RHS->getType(); - if (RightV.isUnknown() && (Loc::IsLocType(T) || - (T->isScalarType() && T->isIntegerType()))) { + if ((RightV.isUnknown() || + !getConstraintManager().canReasonAbout(RightV)) + && (Loc::IsLocType(T) || + (T->isScalarType() && T->isIntegerType()))) { unsigned Count = Builder->getCurrentBlockCount(); SymbolRef Sym = SymMgr.getConjuredSymbol(B->getRHS(), Count); @@ -2604,8 +2607,7 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, } // Simulate the effects of a "store": bind the value of the RHS - // to the L-Value represented by the LHS. - + // to the L-Value represented by the LHS. EvalStore(Dst, B, LHS, *I2, BindExpr(state, B, RightV), LeftV, RightV); continue; @@ -2760,8 +2762,10 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, SVal LHSVal; - if (Result.isUnknown() && (Loc::IsLocType(CTy) - || (CTy->isScalarType() && CTy->isIntegerType()))) { + if ((Result.isUnknown() || + !getConstraintManager().canReasonAbout(Result)) + && (Loc::IsLocType(CTy) + || (CTy->isScalarType() && CTy->isIntegerType()))) { unsigned Count = Builder->getCurrentBlockCount();