QL: Remove omittable exists variables

This commit is contained in:
Tony Torralba
2022-12-21 16:35:21 +01:00
parent d87c8c75d6
commit f6c3f77602
2 changed files with 12 additions and 14 deletions

View File

@@ -30,17 +30,15 @@ private ClassPredicate getUltimateDef(ClassPredicate p) {
}
predicate redundantOverride(ClassPredicate pred, ClassPredicate sup) {
exists(MemberCall mc |
forwardingOverride(pred, mc, sup) and
// overridden to provide more precise QL doc
not exists(pred.getQLDoc()) and
// overridden to disambiguate
not exists(ClassPredicate other |
getUltimateDef(sup) != getUltimateDef(other) and
pred.getDeclaringType().getASuperType+() = other.getDeclaringType() and
not sup.overrides*(other) and
other.getName() = pred.getName() and
other.getArity() = pred.getArity()
)
forwardingOverride(pred, _, sup) and
// overridden to provide more precise QL doc
not exists(pred.getQLDoc()) and
// overridden to disambiguate
not exists(ClassPredicate other |
getUltimateDef(sup) != getUltimateDef(other) and
pred.getDeclaringType().getASuperType+() = other.getDeclaringType() and
not sup.overrides*(other) and
other.getName() = pred.getName() and
other.getArity() = pred.getArity()
)
}

View File

@@ -202,9 +202,9 @@ module DataFlow {
varaccesValue(e2, v, scope)
)
or
exists(VarDecl v, Formula f, Select sel |
exists(Formula f, Select sel |
getParentFormula*(f) = sel.getWhere() and
varaccesValue(e1, v, f) and
varaccesValue(e1, _, f) and
sel.getExpr(_) = e2
)
or