Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f6f7df4

Browse files
committed
CPP: Speed up nullCheckAssert in InconsistentCheckReturnNull.ql.
1 parent f1f69ef commit f6f7df4

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

cpp/ql/src/Likely Bugs/InconsistentCheckReturnNull.ql

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@ predicate assertInvocation(File f, int line) {
2525
)
2626
}
2727

28-
predicate nullCheckAssert(Expr e, Variable v, Declaration qualifier) {
29-
nullCheckInCondition(e, v, qualifier) and
28+
class InterestingExpr extends Expr {
29+
InterestingExpr() { nullCheckInCondition(this, _, _) }
30+
}
31+
32+
predicate nullCheckAssert(InterestingExpr e, Variable v, Declaration qualifier) {
3033
exists(File f, int i |
31-
e.getLocation().getStartLine() = i and e.getFile() = f and assertInvocation(f, i)
34+
e.getLocation().getStartLine() = i and e.getFile() = f and assertInvocation(f, i) and
35+
nullCheckInCondition(e, v, qualifier)
3236
)
3337
}
3438

0 commit comments

Comments
 (0)