зеркало из https://github.com/github/codeql.git
CPP: Correct overuse of 'toString'.
This commit is contained in:
Родитель
bc5fb24371
Коммит
66dffdde05
|
@ -35,7 +35,7 @@ class CheckForLeapYearOperation extends Operation {
|
|||
CheckForLeapYearOperation() {
|
||||
exists(BinaryArithmeticOperation bo | bo = this |
|
||||
bo.getAnOperand().getValue().toInt() = 4 and
|
||||
bo.getOperator().toString() = "%" and
|
||||
bo.getOperator() = "%" and
|
||||
additionalLogicalCheck(this.getEnclosingElement(), "%", 100) and
|
||||
additionalLogicalCheck(this.getEnclosingElement(), "%", 400)
|
||||
)
|
||||
|
@ -144,7 +144,7 @@ abstract class LeapYearFieldAccess extends YearFieldAccess {
|
|||
exists(BinaryArithmeticOperation bo |
|
||||
bo.getAnOperand() = this and
|
||||
bo.getAnOperand().getValue().toInt() = 4 and
|
||||
bo.getOperator().toString() = "%"
|
||||
bo.getOperator() = "%"
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -168,14 +168,14 @@ abstract class LeapYearFieldAccess extends YearFieldAccess {
|
|||
* `YearFieldAccess` for the `SYSTEMTIME` struct.
|
||||
*/
|
||||
class StructSystemTimeLeapYearFieldAccess extends LeapYearFieldAccess {
|
||||
StructSystemTimeLeapYearFieldAccess() { this.toString() = "wYear" }
|
||||
StructSystemTimeLeapYearFieldAccess() { this.getTarget().getName() = "wYear" }
|
||||
}
|
||||
|
||||
/**
|
||||
* `YearFieldAccess` for `struct tm`.
|
||||
*/
|
||||
class StructTmLeapYearFieldAccess extends LeapYearFieldAccess {
|
||||
StructTmLeapYearFieldAccess() { this.toString() = "tm_year" }
|
||||
StructTmLeapYearFieldAccess() { this.getTarget().getName() = "tm_year" }
|
||||
|
||||
override predicate isUsedInCorrectLeapYearCheck() {
|
||||
this.isUsedInMod4Operation() and
|
||||
|
|
|
@ -9,8 +9,8 @@ import cpp
|
|||
*/
|
||||
class FileTimeStruct extends Type {
|
||||
FileTimeStruct() {
|
||||
this.toString() = "_FILETIME"
|
||||
or this.toString().matches("_FILETIME %")
|
||||
this.getName() = "_FILETIME"
|
||||
or this.getName().matches("_FILETIME %")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,12 +20,12 @@ class FileTimeStruct extends Type {
|
|||
*/
|
||||
class DateDataStruct extends Type {
|
||||
DateDataStruct() {
|
||||
this.toString() = "_SYSTEMTIME"
|
||||
or this.toString() = "SYSTEMTIME"
|
||||
or this.toString() = "tm"
|
||||
or this.toString().matches("_SYSTEMTIME %")
|
||||
or this.toString().matches("SYSTEMTIME %")
|
||||
or this.toString().matches("tm %")
|
||||
this.getName() = "_SYSTEMTIME"
|
||||
or this.getName() = "SYSTEMTIME"
|
||||
or this.getName() = "tm"
|
||||
or this.getName().matches("_SYSTEMTIME %")
|
||||
or this.getName().matches("SYSTEMTIME %")
|
||||
or this.getName().matches("tm %")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ abstract class YearFieldAccess extends StructFieldAccess {}
|
|||
*/
|
||||
class SystemTimeDayFieldAccess extends DayFieldAccess {
|
||||
SystemTimeDayFieldAccess () {
|
||||
this.toString() = "wDay"
|
||||
this.getTarget().getName() = "wDay"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ class SystemTimeDayFieldAccess extends DayFieldAccess {
|
|||
*/
|
||||
class SystemTimeMonthFieldAccess extends MonthFieldAccess {
|
||||
SystemTimeMonthFieldAccess () {
|
||||
this.toString() = "wMonth"
|
||||
this.getTarget().getName() = "wMonth"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ class SystemTimeMonthFieldAccess extends MonthFieldAccess {
|
|||
*/
|
||||
class StructSystemTimeYearFieldAccess extends YearFieldAccess {
|
||||
StructSystemTimeYearFieldAccess() {
|
||||
this.toString() = "wYear"
|
||||
this.getTarget().getName() = "wYear"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ class StructSystemTimeYearFieldAccess extends YearFieldAccess {
|
|||
*/
|
||||
class StructTmDayFieldAccess extends DayFieldAccess {
|
||||
StructTmDayFieldAccess() {
|
||||
this.toString() = "tm_mday"
|
||||
this.getTarget().getName() = "tm_mday"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class StructTmDayFieldAccess extends DayFieldAccess {
|
|||
*/
|
||||
class StructTmMonthFieldAccess extends MonthFieldAccess {
|
||||
StructTmMonthFieldAccess() {
|
||||
this.toString() = "tm_mon"
|
||||
this.getTarget().getName() = "tm_mon"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,6 @@ class StructTmMonthFieldAccess extends MonthFieldAccess {
|
|||
*/
|
||||
class StructTmYearFieldAccess extends YearFieldAccess {
|
||||
StructTmYearFieldAccess() {
|
||||
this.toString() = "tm_year"
|
||||
this.getTarget().getName() = "tm_year"
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче