[analyzer] Teach ConstraintManager to ignore NonLoc <> NonLoc comparisons.
These aren't generated by default, but they are needed when either side of the comparison is tainted. Should fix our internal buildbot. llvm-svn: 177846
This commit is contained in:
parent
9619fc0bd1
commit
d1d8929370
|
@ -50,8 +50,13 @@ bool SimpleConstraintManager::canReasonAbout(SVal X) const {
|
|||
}
|
||||
|
||||
if (const SymSymExpr *SSE = dyn_cast<SymSymExpr>(SE)) {
|
||||
if (BinaryOperator::isComparisonOp(SSE->getOpcode()))
|
||||
return true;
|
||||
if (BinaryOperator::isComparisonOp(SSE->getOpcode())) {
|
||||
// We handle Loc <> Loc comparisons, but not (yet) NonLoc <> NonLoc.
|
||||
if (Loc::isLocType(SSE->getLHS()->getType())) {
|
||||
assert(Loc::isLocType(SSE->getRHS()->getType()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -212,3 +212,14 @@ int SymSymExprWithDiffTypes(void* p) {
|
|||
return 5/j; // expected-warning {{Division by a tainted value, possibly zero}}
|
||||
}
|
||||
|
||||
|
||||
void constraintManagerShouldTreatAsOpaque(int rhs) {
|
||||
int i;
|
||||
scanf("%d", &i);
|
||||
// This comparison used to hit an assertion in the constraint manager,
|
||||
// which didn't handle NonLoc sym-sym comparisons.
|
||||
if (i < rhs)
|
||||
return;
|
||||
if (i < rhs)
|
||||
*(volatile int *) 0; // no-warning
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue