Python: Use CallableValue and improve tests

This commit is contained in:
Rasmus Lerchedahl Petersen
2020-06-17 19:12:10 +02:00
parent f24dc69e1d
commit ce57a28c8f
4 changed files with 27 additions and 9 deletions

View File

@@ -9,6 +9,12 @@ class AllFlowsConfig extends DataFlow::Configuration {
override predicate isSource(DataFlow::Node node) {
node.asCfgNode().isEntryNode()
or
node = DataFlow::TEssaNode(_) and
not exists(DataFlow::Node pred |
pred = DataFlow::TEssaNode(_) and
DataFlow::localFlowStep(pred, node)
)
}
override predicate isSink(DataFlow::Node node) {

View File

@@ -2,5 +2,6 @@
| test.py:1:5:1:5 | ControlFlowNode for IntegerLiteral | test.py:1:1:1:1 | GSSA Variable a |
| test.py:2:5:2:5 | ControlFlowNode for a | test.py:2:1:2:1 | GSSA Variable b |
| test.py:4:1:4:9 | ControlFlowNode for FunctionExpr | test.py:4:5:4:5 | GSSA Variable f |
| test.py:4:7:4:7 | ControlFlowNode for x | test.py:4:7:4:7 | SSA variable x |
| test.py:5:7:5:11 | ControlFlowNode for BinaryExpr | test.py:5:3:5:3 | SSA variable y |
| test.py:8:5:8:8 | ControlFlowNode for f() | test.py:8:1:8:1 | GSSA Variable c |

View File

@@ -1,2 +1,12 @@
| test.py:0:0:0:0 | Entry node for Module test |
| test.py:0:0:0:0 | GSSA Variable __name__ |
| test.py:0:0:0:0 | GSSA Variable __package__ |
| test.py:0:0:0:0 | GSSA Variable c |
| test.py:0:0:0:0 | SSA variable $ |
| test.py:1:1:1:1 | GSSA Variable a |
| test.py:2:1:2:1 | GSSA Variable b |
| test.py:4:1:4:9 | Entry node for Function f |
| test.py:4:5:4:5 | GSSA Variable f |
| test.py:4:7:4:7 | SSA variable x |
| test.py:5:3:5:3 | SSA variable y |
| test.py:8:1:8:1 | GSSA Variable c |