Skip to content

Commit 34b6259

Browse files
committed
C++: Avoid extends Operation in LeapYear.qll
The `Operation` class is abstract, and extending it caused cached stages to be recomputed all the way down to the AST. This meant that the leap year queries evaluated their own copy of SSA and data flow.
1 parent f417640 commit 34b6259

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private predicate additionalLogicalCheck(Expr e, string operation, int valueToCh
3030
/**
3131
* An `Operation` that seems to be checking for leap year.
3232
*/
33-
class CheckForLeapYearOperation extends Operation {
33+
class CheckForLeapYearOperation extends Expr {
3434
CheckForLeapYearOperation() {
3535
exists(BinaryArithmeticOperation bo | bo = this |
3636
bo.getAnOperand().getValue().toInt() = 4 and
@@ -39,8 +39,6 @@ class CheckForLeapYearOperation extends Operation {
3939
additionalLogicalCheck(this.getEnclosingElement(), "%", 400)
4040
)
4141
}
42-
43-
override string getOperator() { result = "LeapYearCheck" }
4442
}
4543

4644
/**

0 commit comments

Comments
 (0)