SimpleConstraintManager doesn't reason about bitwise-constraints on symbolic

values. Indicating this in 'canReasonAbout' allows GRExprEngine to recover
path-sensitivity in some cases.

llvm-svn: 66628
This commit is contained in:
Ted Kremenek
2009-03-11 02:29:48 +00:00
parent 44c12ef615
commit 3f5a85ad06
2 changed files with 26 additions and 0 deletions

View File

@@ -21,6 +21,19 @@ namespace clang {
SimpleConstraintManager::~SimpleConstraintManager() {}
bool SimpleConstraintManager::canReasonAbout(SVal X) const {
if (nonloc::SymIntConstraintVal *Y = dyn_cast<nonloc::SymIntConstraintVal>(&X)) {
const SymIntConstraint& C = Y->getConstraint();
switch (C.getOpcode()) {
// We don't reason yet about bitwise-constraints on symbolic values.
case BinaryOperator::And:
case BinaryOperator::Or:
case BinaryOperator::Xor:
return false;
default:
return true;
}
}
return true;
}

View File

@@ -165,3 +165,16 @@ my_test_mm_movepi64_pi64(__a128vector a) {
}
@end
// PR 3770
char pr3770(int x) {
int y = x & 0x2;
char *p = 0;
if (y == 1)
p = "hello";
if (y == 1)
return p[0]; // no-warning
return 'a';
}