Merge pull request #1575 from jbj/UncheckedLeapYear-bb

C++: Fix performance of unchecked leap year query
This commit is contained in:
Geoffrey White
2019-07-11 13:57:07 +01:00
committed by GitHub

View File

@@ -24,7 +24,7 @@ where
exists(LeapYearFieldAccess yfacheck | exists(LeapYearFieldAccess yfacheck |
yfacheck.getQualifier() = var.getAnAccess() and yfacheck.getQualifier() = var.getAnAccess() and
yfacheck.isUsedInCorrectLeapYearCheck() and yfacheck.isUsedInCorrectLeapYearCheck() and
yfacheck = yfa.getASuccessor*() yfacheck.getBasicBlock() = yfa.getBasicBlock().getASuccessor*()
) )
or or
// If there is a data flow from the variable that was modified to a function that seems to check for leap year // If there is a data flow from the variable that was modified to a function that seems to check for leap year
@@ -50,8 +50,8 @@ where
mfa.getQualifier() = var.getAnAccess() and mfa.getQualifier() = var.getAnAccess() and
mfa.isModified() and mfa.isModified() and
( (
mfa = yfa.getASuccessor*() or mfa.getBasicBlock() = yfa.getBasicBlock().getASuccessor*() or
yfa = mfa.getASuccessor*() yfa.getBasicBlock() = mfa.getBasicBlock().getASuccessor+()
) and ) and
ae = mfa.getEnclosingElement() and ae = mfa.getEnclosingElement() and
ae.getAnOperand().getValue().toInt() = 1 ae.getAnOperand().getValue().toInt() = 1