mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Python: Clarify pruning code.
This commit is contained in:
@@ -423,7 +423,7 @@ module Pruner {
|
||||
reachableEdge(_, bb)
|
||||
}
|
||||
|
||||
Constraint constraintFromTest(SsaVariable var, UnprunedCfgNode node) {
|
||||
Constraint constraintFromExpr(SsaVariable var, UnprunedCfgNode node) {
|
||||
py_ssa_use(node, var) and result = TTruthy(true)
|
||||
or
|
||||
exists(boolean b |
|
||||
@@ -435,7 +435,11 @@ module Pruner {
|
||||
result = TConstrainedByConstant(op, k)
|
||||
)
|
||||
or
|
||||
result = constraintFromTest(var, node.(UnprunedNot).getOperand()).invert()
|
||||
result = constraintFromExpr(var, node.(UnprunedNot).getOperand()).invert()
|
||||
}
|
||||
|
||||
Constraint constraintFromTest(SsaVariable var, UnprunedCfgNode node) {
|
||||
result = constraintFromExpr(var, node) and node.isBranch()
|
||||
}
|
||||
|
||||
predicate none_test(UnprunedCompareNode test, SsaVariable var, boolean is) {
|
||||
@@ -462,8 +466,6 @@ module Pruner {
|
||||
py_ssa_use(right, var) and
|
||||
intValue(left.getNode()) = k
|
||||
)
|
||||
or
|
||||
int_test(test.(UnprunedNot).getOperand(), var, op.invert(), k)
|
||||
}
|
||||
|
||||
private predicate constrainingValue(Expr e) {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
| 8 | test | test | Truthy | test |
|
||||
| 10 | test | test | Truthy | test |
|
||||
| 14 | seq | seq | Truthy | test |
|
||||
| 16 | seq | seq | Truthy | test |
|
||||
| 17 | seq | seq | Truthy | test |
|
||||
| 21 | UnaryExpr | t1 | Falsey | test |
|
||||
| 21 | t1 | t1 | Truthy | test |
|
||||
| 24 | t1 | t1 | Truthy | test |
|
||||
| 25 | t1 | t1 | Truthy | test |
|
||||
| 26 | t2 | t2 | Truthy | test |
|
||||
@@ -24,7 +22,6 @@
|
||||
| 40 | t6 | t6 | Truthy | test |
|
||||
| 43 | t1 | t1 | Truthy | test |
|
||||
| 44 | UnaryExpr | t2 | Falsey | test |
|
||||
| 44 | t2 | t2 | Truthy | test |
|
||||
| 47 | t1 | t1 | Truthy | test |
|
||||
| 48 | t2 | t2 | Truthy | test |
|
||||
| 49 | t2 | t2 | Truthy | test |
|
||||
@@ -32,83 +29,36 @@
|
||||
| 52 | t2 | t2 | Truthy | test |
|
||||
| 55 | seq1 | seq1 | Truthy | test |
|
||||
| 57 | UnaryExpr | seq2 | Falsey | test |
|
||||
| 57 | seq2 | seq2 | Truthy | test |
|
||||
| 60 | seq1 | seq1 | Truthy | test |
|
||||
| 62 | seq1 | seq1 | Truthy | test |
|
||||
| 63 | seq2 | seq2 | Truthy | test |
|
||||
| 65 | seq2 | seq2 | Truthy | test |
|
||||
| 66 | seq3 | seq3 | Truthy | test |
|
||||
| 68 | UnaryExpr | seq4 | Falsey | test |
|
||||
| 68 | seq4 | seq4 | Truthy | test |
|
||||
| 71 | seq3 | seq3 | Truthy | test |
|
||||
| 73 | var | var | Truthy | test |
|
||||
| 74 | seq4 | seq4 | Truthy | test |
|
||||
| 76 | var | var | Truthy | test |
|
||||
| 78 | seq5 | seq5 | Truthy | test |
|
||||
| 80 | seq5 | seq5 | Truthy | test |
|
||||
| 81 | seq5 | seq5 | Truthy | test |
|
||||
| 83 | var | var | Truthy | test |
|
||||
| 88 | UnaryExpr | x | Falsey | test |
|
||||
| 88 | x | x | Truthy | test |
|
||||
| 89 | Exception | Exception | Truthy | test |
|
||||
| 90 | y | y | Truthy | test |
|
||||
| 91 | Exception | Exception | Truthy | test |
|
||||
| 92 | make_a_call | make_a_call | Truthy | test |
|
||||
| 93 | UnaryExpr | x | Falsey | test |
|
||||
| 93 | x | x | Truthy | test |
|
||||
| 94 | count | count | Truthy | test |
|
||||
| 95 | y | y | Truthy | test |
|
||||
| 96 | count | count | Truthy | test |
|
||||
| 99 | another_module | another_module | Truthy | assign |
|
||||
| 101 | make_a_call | make_a_call | Truthy | test |
|
||||
| 102 | UnaryExpr | another_module | Falsey | test |
|
||||
| 102 | another_module | another_module | Truthy | test |
|
||||
| 103 | count | count | Truthy | test |
|
||||
| 107 | UnaryExpr | t1 | Falsey | test |
|
||||
| 107 | t1 | t1 | Truthy | test |
|
||||
| 109 | t2 | t2 | Truthy | test |
|
||||
| 111 | t1 | t1 | Truthy | test |
|
||||
| 113 | UnaryExpr | t2 | Falsey | test |
|
||||
| 113 | t2 | t2 | Truthy | test |
|
||||
| 117 | UnaryExpr | test | Falsey | test |
|
||||
| 117 | test | test | Truthy | test |
|
||||
| 119 | UnaryExpr | test | Falsey | test |
|
||||
| 119 | test | test | Truthy | test |
|
||||
| 123 | m | m | Truthy | test |
|
||||
| 125 | m | m | Truthy | test |
|
||||
| 126 | m | m | Truthy | test |
|
||||
| 158 | Compare | ps | Is not None | test |
|
||||
| 158 | ps | ps | Truthy | test |
|
||||
| 159 | ps | ps | Truthy | test |
|
||||
| 160 | Compare | ps | Is None | test |
|
||||
| 160 | ps | ps | Truthy | test |
|
||||
| 171 | __name__ | __name__ | Truthy | test |
|
||||
| 172 | None | None | Truthy | test |
|
||||
| 172 | escapes | escapes | Is None | assign |
|
||||
| 174 | func | func | Truthy | test |
|
||||
| 175 | Exception | Exception | Truthy | test |
|
||||
| 176 | count | count | Truthy | test |
|
||||
| 177 | Compare | escapes | Is None | test |
|
||||
| 177 | None | None | Truthy | test |
|
||||
| 177 | escapes | escapes | Truthy | test |
|
||||
| 178 | count | count | Truthy | test |
|
||||
| 180 | count | count | Truthy | test |
|
||||
| 188 | true12 | true12 | Truthy | test |
|
||||
| 191 | true12 | true12 | == 0 | assign |
|
||||
| 195 | Compare | x | < 4 | test |
|
||||
| 195 | x | x | Truthy | test |
|
||||
| 197 | Compare | x | < 4 | test |
|
||||
| 197 | x | x | Truthy | test |
|
||||
| 201 | Compare | x | < 4 | test |
|
||||
| 201 | x | x | Truthy | test |
|
||||
| 203 | Compare | x | >= 4 | test |
|
||||
| 203 | UnaryExpr | x | < 4 | test |
|
||||
| 203 | x | x | Truthy | test |
|
||||
| 207 | Compare | x | < 4 | test |
|
||||
| 207 | x | x | Truthy | test |
|
||||
| 209 | Compare | x | < 4 | test |
|
||||
| 209 | x | x | Truthy | test |
|
||||
| 214 | None | None | Truthy | test |
|
||||
| 215 | x | x | Truthy | test |
|
||||
| 215 | y | y | Truthy | test |
|
||||
| 217 | x | x | Truthy | test |
|
||||
|
||||
Reference in New Issue
Block a user