CPP: Speed up nullCheckAssert in InconsistentCheckReturnNull.ql.

This commit is contained in:
Geoffrey White
2019-12-13 15:46:15 +00:00
parent f1f69ef85d
commit f6f7df4e8f

View File

@@ -25,10 +25,14 @@ predicate assertInvocation(File f, int line) {
)
}
predicate nullCheckAssert(Expr e, Variable v, Declaration qualifier) {
nullCheckInCondition(e, v, qualifier) and
class InterestingExpr extends Expr {
InterestingExpr() { nullCheckInCondition(this, _, _) }
}
predicate nullCheckAssert(InterestingExpr e, Variable v, Declaration qualifier) {
exists(File f, int i |
e.getLocation().getStartLine() = i and e.getFile() = f and assertInvocation(f, i)
e.getLocation().getStartLine() = i and e.getFile() = f and assertInvocation(f, i) and
nullCheckInCondition(e, v, qualifier)
)
}