mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Python: bit more local flow and fix ql docs
This commit is contained in:
@@ -76,7 +76,6 @@ class DataFlowExpr = Expr;
|
||||
* excludes SSA flow through instance fields.
|
||||
*/
|
||||
predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
|
||||
|
||||
exists(EssaEdgeRefinement r |
|
||||
nodeTo.asEssaNode() = r.getVariable() and
|
||||
nodeFrom.asEssaNode() = r.getInput()
|
||||
@@ -86,6 +85,16 @@ predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
|
||||
nodeTo.asEssaNode() = r.getVariable() and
|
||||
nodeFrom.asEssaNode() = r.getInput()
|
||||
)
|
||||
or
|
||||
exists(PhiFunction p |
|
||||
nodeTo.asEssaNode() = p.getVariable() and
|
||||
nodeFrom.asEssaNode() = p.getShortCircuitInput()
|
||||
)
|
||||
or
|
||||
exists(EssaNodeDefinition d |
|
||||
nodeTo.asEssaNode() = d.getVariable() and
|
||||
nodeFrom.asEssaNode().getDefinition().getLocation() = d.(AssignmentDefinition).getValue().getLocation() // TODO: A better way to tie these together
|
||||
)
|
||||
}
|
||||
|
||||
//--------
|
||||
|
||||
@@ -5,7 +5,13 @@
|
||||
import python
|
||||
private import DataFlowPrivate
|
||||
|
||||
/**
|
||||
* IPA type for dta flow nodes.
|
||||
*/
|
||||
newtype TNode =
|
||||
/**
|
||||
* A node corresponding to local flow as computed via SSA.
|
||||
*/
|
||||
TEssaNode(EssaVariable var)
|
||||
|
||||
/**
|
||||
@@ -14,8 +20,14 @@ newtype TNode =
|
||||
*/
|
||||
class Node extends TNode {
|
||||
|
||||
/**
|
||||
* Get the underlying SSA variable if this is such a node.
|
||||
*/
|
||||
EssaVariable asEssaNode() { this = TEssaNode(result) }
|
||||
|
||||
/**
|
||||
* Get a string representation of this data flow node.
|
||||
*/
|
||||
string toString() { result = this.asEssaNode().toString() }
|
||||
|
||||
/** Gets the enclosing callable of this node. */
|
||||
|
||||
Reference in New Issue
Block a user