summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-11 02:24:48 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-11 02:24:48 +0000
commit44c12ef6151d285996e24afcb4e49decf38375ee (patch)
tree802acffc583e6938aa02ac05302574e37683e60d /clang
parent1f10b9664b725a607906c4ab639d9b485cb2be05 (diff)
downloadbcm5719-llvm-44c12ef6151d285996e24afcb4e49decf38375ee.tar.gz
bcm5719-llvm-44c12ef6151d285996e24afcb4e49decf38375ee.zip
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. llvm-svn: 66627
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Analysis/GRExprEngine.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp
index 222ef173e89..8bc84d4bf52 100644
--- a/clang/lib/Analysis/GRExprEngine.cpp
+++ b/clang/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();
OpenPOWER on IntegriCloud