Skip to content

Commit 38548c9

Browse files
authored
Python: Simplify charpred for LocalSourceNode
The somewhat convoluted `comes_from_cfgnode` was originally introduced in order to have local sources for instances of global variables. This was needed because global variables have an implicit "scope entry" SSA definition that flows to the first actual use of the variable (and so would not fit the strict "has no incoming flow" definition of a local source node). However, a subsequent change means that we include all global variable reads anyway, and so the old definition is no longer needed. (See commit 3fafb47 for further context.)
1 parent 038bf61 commit 38548c9

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

python/ql/src/semmle/python/dataflow/new/internal/LocalSources.qll

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ import python
1010
import DataFlowPublic
1111
private import DataFlowPrivate
1212

13-
private predicate comes_from_cfgnode(Node node) {
14-
exists(CfgNode first, Node second |
15-
simpleLocalFlowStep(first, second) and
16-
simpleLocalFlowStep*(second, node)
17-
)
18-
}
19-
2013
/**
2114
* A data flow node that is a source of local flow. This includes things like
2215
* - Expressions
@@ -40,7 +33,7 @@ private predicate comes_from_cfgnode(Node node) {
4033
class LocalSourceNode extends Node {
4134
cached
4235
LocalSourceNode() {
43-
not comes_from_cfgnode(this) and
36+
not simpleLocalFlowStep(_, this) and
4437
// Currently, we create synthetic post-update nodes for
4538
// - arguments to calls that may modify said argument
4639
// - direct reads a writes of object attributes

0 commit comments

Comments
 (0)