Python: Add getPostUpdateNode to DataFlow::Node

as discussed in https://github.com/github/codeql/pull/5864#discussion_r634675940
This commit is contained in:
Rasmus Wriedt Larsen
2021-05-19 11:57:49 +02:00
parent 0c970b5f1f
commit 9137f04bd3
2 changed files with 4 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ module syntheticPreUpdateNode {
SyntheticPreUpdateNode() { this = TSyntheticPreUpdateNode(post) }
/** Gets the node for which this is a synthetic pre-update node. */
Node getPostUpdateNode() { result = post }
override NeedsSyntheticPreUpdateNode getPostUpdateNode() { result = post }
override string toString() { result = "[pre " + post.label() + "] " + post.toString() }

View File

@@ -123,6 +123,9 @@ class Node extends TNode {
* Gets a local source node from which data may flow to this node in zero or more local data-flow steps.
*/
LocalSourceNode getALocalSource() { result.flowsTo(this) }
/** Gets the `PostUpdateNode` for this node, if any. */
PostUpdateNode getPostUpdateNode() { result.getPreUpdateNode() = this }
}
/** A data-flow node corresponding to an SSA variable. */