Skip to content

Commit b51c78a

Browse files
authored
Merge pull request #1546 from geoffw0/eraperf
CPP: Speed up LeapYear.qll 'ChecksForLeapYearFunctionCall'.
2 parents 0290c79 + 70b996f commit b51c78a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

cpp/ql/src/Likely Bugs/Leap Year/LeapYear.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,21 @@ class StructTmLeapYearFieldAccess extends LeapYearFieldAccess {
194194
}
195195
}
196196

197+
/**
198+
* `Function` that includes an operation that is checking for leap year.
199+
*/
200+
class ChecksForLeapYearFunction extends Function {
201+
ChecksForLeapYearFunction() {
202+
this = any(CheckForLeapYearOperation clyo).getEnclosingFunction()
203+
}
204+
}
205+
197206
/**
198207
* `FunctionCall` that includes an operation that is checking for leap year.
199208
*/
200209
class ChecksForLeapYearFunctionCall extends FunctionCall {
201210
ChecksForLeapYearFunctionCall() {
202-
exists(Function f, CheckForLeapYearOperation clyo | f.getACallToThisFunction() = this |
203-
clyo.getEnclosingFunction() = f
204-
)
211+
this.getTarget() instanceof ChecksForLeapYearFunction
205212
}
206213
}
207214

0 commit comments

Comments
 (0)