Skip to content

Commit 22e1921

Browse files
authored
Merge pull request #17313 from hvitved/dataflow/to-normal-sink-node-ex
Data flow: Move `toNormalSinkNodeEx` into `PathNodeMid`
2 parents 3a864d3 + b589fca commit 22e1921

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,6 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
246246
ReturnKindExt getKind() { result = pos.getKind() }
247247
}
248248

249-
/** If `node` corresponds to a sink, gets the normal node for that sink. */
250-
pragma[nomagic]
251-
private NodeEx toNormalSinkNodeEx(NodeEx node) {
252-
exists(Node n |
253-
node.asNodeOrImplicitRead() = n and
254-
(Config::isSink(n) or Config::isSink(n, _)) and
255-
result.asNode() = n
256-
)
257-
}
258-
259249
private predicate inBarrier(NodeEx node) {
260250
exists(Node n |
261251
node.asNode() = n and
@@ -2607,7 +2597,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
26072597
TPathNodeSink(NodeEx node, FlowState state) {
26082598
exists(PathNodeMid sink |
26092599
sink.isAtSink() and
2610-
node = toNormalSinkNodeEx(sink.getNodeEx()) and
2600+
node = sink.toNormalSinkNodeEx() and
26112601
state = sink.getState()
26122602
)
26132603
} or
@@ -2734,6 +2724,16 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
27342724
)
27352725
}
27362726

2727+
/** If this node corresponds to a sink, gets the normal node for that sink. */
2728+
pragma[nomagic]
2729+
NodeEx toNormalSinkNodeEx() {
2730+
exists(Node n |
2731+
pragma[only_bind_out](node.asNodeOrImplicitRead()) = n and
2732+
(Config::isSink(n) or Config::isSink(n, _)) and
2733+
result.asNode() = n
2734+
)
2735+
}
2736+
27372737
override PathNodeImpl getASuccessorImpl(string label) {
27382738
// an intermediate step to another intermediate node
27392739
exists(string l2 | result = this.getSuccMid(l2) |
@@ -2825,7 +2825,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
28252825
PathNodeSink projectToSink(string model) {
28262826
this.isAtSink() and
28272827
sinkModel(node, model) and
2828-
result.getNodeEx() = toNormalSinkNodeEx(node) and
2828+
result.getNodeEx() = this.toNormalSinkNodeEx() and
28292829
result.getState() = state
28302830
}
28312831
}

0 commit comments

Comments
 (0)