@@ -180,10 +180,8 @@ final class ExprCheckCenturyComponentDiv400Inverted extends ExprCheckCenturyComp
180180 */
181181class ExprCheckCenturyComponent extends LogicalOrExpr {
182182 ExprCheckCenturyComponent ( ) {
183- exists ( ExprCheckCenturyComponentDiv400 exprDiv400 , ExprCheckCenturyComponentDiv100 exprDiv100 |
184- this .getAnOperand ( ) = exprDiv100 and
185- this .getAnOperand ( ) = exprDiv400
186- )
183+ this .getAnOperand ( ) instanceof ExprCheckCenturyComponentDiv100 and
184+ this .getAnOperand ( ) instanceof ExprCheckCenturyComponentDiv400
187185 }
188186
189187 Expr getYearExpr ( ) {
@@ -205,8 +203,8 @@ abstract class ExprCheckLeapYear extends Expr { }
205203 */
206204final class ExprCheckLeapYearFormA extends ExprCheckLeapYear , LogicalAndExpr {
207205 ExprCheckLeapYearFormA ( ) {
208- exists ( Expr e , ExprCheckCenturyComponent centuryCheck |
209- e = moduloCheckEQ_0 ( this .getLeftOperand ( ) , 4 ) and
206+ exists ( ExprCheckCenturyComponent centuryCheck |
207+ exists ( moduloCheckEQ_0 ( this .getLeftOperand ( ) , 4 ) ) and
210208 centuryCheck = this .getAnOperand ( ) .getAChild * ( )
211209 )
212210 }
@@ -219,10 +217,11 @@ final class ExprCheckLeapYearFormA extends ExprCheckLeapYear, LogicalAndExpr {
219217 */
220218final class ExprCheckLeapYearFormB extends ExprCheckLeapYear , LogicalOrExpr {
221219 ExprCheckLeapYearFormB ( ) {
222- exists ( VariableAccess va1 , VariableAccess va2 , VariableAccess va3 |
223- va1 = moduloCheckEQ_0 ( this .getAnOperand ( ) , 400 ) and
224- va2 = moduloCheckNEQ_0 ( this .getAnOperand ( ) .( LogicalAndExpr ) .getAnOperand ( ) , 100 ) and
225- va3 = moduloCheckEQ_0 ( this .getAnOperand ( ) .( LogicalAndExpr ) .getAnOperand ( ) , 4 )
220+ exists ( LogicalAndExpr land |
221+ exists ( moduloCheckEQ_0 ( this .getAnOperand ( ) , 400 ) ) and
222+ land = this .getAnOperand ( ) and
223+ exists ( moduloCheckNEQ_0 ( land .getAnOperand ( ) , 100 ) ) and
224+ exists ( moduloCheckEQ_0 ( land .getAnOperand ( ) , 4 ) )
226225 )
227226 }
228227}
@@ -375,32 +374,24 @@ class DateCheckMonthFebruary extends Operation {
375374/**
376375 * `stDate.wDay == 29`
377376 */
378- class DateCheckDay29 extends Operation {
379- DateCheckDay29 ( ) {
380- this .getOperator ( ) = "==" and
381- this .getAnOperand ( ) instanceof DayFieldAccess and
382- this .getAnOperand ( ) .( Literal ) .getValue ( ) = "29"
383- }
377+ class DateCheckDay29 extends EQExpr {
378+ DayFieldAccess dfa ;
379+
380+ DateCheckDay29 ( ) { this .hasOperands ( dfa , any ( Literal lit | lit .getValue ( ) = "29" ) ) }
384381
385- Expr getDateQualifier ( ) { result = this . getAnOperand ( ) . ( DayFieldAccess ) .getQualifier ( ) }
382+ Expr getDateQualifier ( ) { result = dfa .getQualifier ( ) }
386383}
387384
388385/**
389386 * The combination of a February and Day 29 verification
390387 * `stDate.wMonth == 2 && stDate.wDay == 29`
391388 */
392- class DateFebruary29Check extends Operation {
393- DateFebruary29Check ( ) {
394- this .getOperator ( ) = "&&" and
395- exists ( DateCheckMonthFebruary checkFeb , DateCheckDay29 check29 |
396- checkFeb = this .getAnOperand ( ) and
397- check29 = this .getAnOperand ( )
398- )
399- }
389+ class DateFebruary29Check extends LogicalAndExpr {
390+ DateCheckMonthFebruary checkFeb ;
400391
401- Expr getDateQualifier ( ) {
402- result = this . getAnOperand ( ) . ( DateCheckMonthFebruary ) . getDateQualifier ( )
403- }
392+ DateFebruary29Check ( ) { this . hasOperands ( checkFeb , any ( DateCheckDay29 check29 ) ) }
393+
394+ Expr getDateQualifier ( ) { result = checkFeb . getDateQualifier ( ) }
404395}
405396
406397/**
@@ -533,20 +524,20 @@ class TimeConversionFunction extends Function {
533524 TimeConversionFunction ( ) {
534525 autoLeapYearCorrecting = false and
535526 (
536- this .getQualifiedName ( ) =
527+ this .getName ( ) =
537528 [
538529 "FileTimeToSystemTime" , "SystemTimeToFileTime" , "SystemTimeToTzSpecificLocalTime" ,
539530 "SystemTimeToTzSpecificLocalTimeEx" , "TzSpecificLocalTimeToSystemTime" ,
540531 "TzSpecificLocalTimeToSystemTimeEx" , "RtlLocalTimeToSystemTime" ,
541- "RtlTimeToSecondsSince1970" , "_mkgmtime" , "SetSystemTime" , "VarUdateFromDate" ,
542- "boost::gregorian::date::from_tm"
532+ "RtlTimeToSecondsSince1970" , "_mkgmtime" , "SetSystemTime" , "VarUdateFromDate" , "from_tm"
543533 ]
544534 or
545- this .getQualifiedName ( ) .matches ( "GetDateFormat%" )
535+ // Matches all forms of GetDateFormat, e.g. GetDateFormatA/W/Ex
536+ this .getName ( ) .matches ( "GetDateFormat%" )
546537 )
547538 or
548539 autoLeapYearCorrecting = true and
549- this .getQualifiedName ( ) =
540+ this .getName ( ) =
550541 [ "mktime" , "_mktime32" , "_mktime64" , "SystemTimeToVariantTime" , "VariantTimeToSystemTime" ]
551542 }
552543
0 commit comments