mirror of
https://github.com/github/codeql.git
synced 2025-12-22 19:56:32 +01:00
CPP: Rename 'getAssertedFalseCondition' to something less misleading.
This commit is contained in:
@@ -89,9 +89,9 @@ class ParameterNullCheck extends ParameterCheck {
|
|||||||
(
|
(
|
||||||
va = this.(NotExpr).getOperand() or
|
va = this.(NotExpr).getOperand() or
|
||||||
va = any(EQExpr eq | eq = this and eq.getAnOperand().getValue() = "0").getAnOperand() or
|
va = any(EQExpr eq | eq = this and eq.getAnOperand().getValue() = "0").getAnOperand() or
|
||||||
va = getAssertedFalseCondition(this) or
|
va = getCheckedFalseCondition(this) or
|
||||||
va = any(NEExpr eq |
|
va = any(NEExpr eq |
|
||||||
eq = getAssertedFalseCondition(this) and eq.getAnOperand().getValue() = "0"
|
eq = getCheckedFalseCondition(this) and eq.getAnOperand().getValue() = "0"
|
||||||
).getAnOperand()
|
).getAnOperand()
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -101,7 +101,7 @@ class ParameterNullCheck extends ParameterCheck {
|
|||||||
va = this or
|
va = this or
|
||||||
va = any(NEExpr eq | eq = this and eq.getAnOperand().getValue() = "0").getAnOperand() or
|
va = any(NEExpr eq | eq = this and eq.getAnOperand().getValue() = "0").getAnOperand() or
|
||||||
va = any(EQExpr eq |
|
va = any(EQExpr eq |
|
||||||
eq = getAssertedFalseCondition(this) and eq.getAnOperand().getValue() = "0"
|
eq = getCheckedFalseCondition(this) and eq.getAnOperand().getValue() = "0"
|
||||||
).getAnOperand()
|
).getAnOperand()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -669,7 +669,7 @@ FieldAccess getAFieldAccess(Variable v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a condition which is asserted to be false by the given `ne` expression, according to this pattern:
|
* Gets a condition which is checked to be false by the given `ne` expression, according to this pattern:
|
||||||
* ```
|
* ```
|
||||||
* int a = !!result;
|
* int a = !!result;
|
||||||
* if (!a) { // <- ne
|
* if (!a) { // <- ne
|
||||||
@@ -677,7 +677,7 @@ FieldAccess getAFieldAccess(Variable v) {
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
Expr getAssertedFalseCondition(NotExpr ne) {
|
private Expr getCheckedFalseCondition(NotExpr ne) {
|
||||||
exists(LocalVariable v |
|
exists(LocalVariable v |
|
||||||
result = v.getInitializer().getExpr().(NotExpr).getOperand().(NotExpr).getOperand() and
|
result = v.getInitializer().getExpr().(NotExpr).getOperand().(NotExpr).getOperand() and
|
||||||
ne.getOperand() = v.getAnAccess() and
|
ne.getOperand() = v.getAnAccess() and
|
||||||
|
|||||||
Reference in New Issue
Block a user