Python: Points-to; let values with no boolean constant value flow through pi-nodes.

This commit is contained in:
Mark Shannon
2019-01-31 15:07:48 +00:00
parent f190f83406
commit 24d678b869
4 changed files with 11 additions and 4 deletions

View File

@@ -2116,10 +2116,15 @@ module PointsTo {
private boolean truth_test_evaluates_boolean(ControlFlowNode expr, ControlFlowNode use, PointsToContext context, Object val, ClassObject cls, ControlFlowNode origin) {
contains_interesting_expression_within_test(expr, use) and
points_to(use, context, val, cls, origin) and
expr = use and
(
expr = use and val.booleanValue() = result
val.booleanValue() = result
or
expr = use and Types::instances_always_true(cls) and result = true
Types::instances_always_true(cls) and result = true
or
val.maybe() and result = true
or
val.maybe() and result = false
)
}

View File

@@ -106,6 +106,7 @@
| b_condition.py:88 | ControlFlowNode for y | 87 |
| b_condition.py:90 | ControlFlowNode for x | 87 |
| b_condition.py:90 | ControlFlowNode for y | 87 |
| b_condition.py:92 | ControlFlowNode for x | 87 |
| b_condition.py:93 | ControlFlowNode for use | 93 |
| b_condition.py:93 | ControlFlowNode for use() | 93 |
| b_condition.py:93 | ControlFlowNode for y | 87 |
@@ -115,6 +116,7 @@
| b_condition.py:96 | ControlFlowNode for y | 87 |
| b_condition.py:97 | ControlFlowNode for use | 97 |
| b_condition.py:97 | ControlFlowNode for use() | 97 |
| b_condition.py:97 | ControlFlowNode for x | 87 |
| b_condition.py:99 | ControlFlowNode for use | 99 |
| b_condition.py:99 | ControlFlowNode for use() | 99 |
| b_condition.py:102 | ControlFlowNode for a | 101 |

View File

@@ -1,2 +1,2 @@
| 0 | 29 | 29 | 100.0 |
| 0 | 31 | 31 | 100.0 |
| 1 | 4 | 40 | 10.0 |

View File

@@ -1,2 +1,2 @@
| 0 | 29 | 29 | 100.0 |
| 0 | 31 | 31 | 100.0 |
| 1 | 3 | 40 | 7.5 |