Skip to content

Data flow: Move toNormalSinkNodeEx into PathNodeMid #17313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,6 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
ReturnKindExt getKind() { result = pos.getKind() }
}

/** If `node` corresponds to a sink, gets the normal node for that sink. */
pragma[nomagic]
private NodeEx toNormalSinkNodeEx(NodeEx node) {
exists(Node n |
node.asNodeOrImplicitRead() = n and
(Config::isSink(n) or Config::isSink(n, _)) and
result.asNode() = n
)
}

private predicate inBarrier(NodeEx node) {
exists(Node n |
node.asNode() = n and
Expand Down Expand Up @@ -2607,7 +2597,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
TPathNodeSink(NodeEx node, FlowState state) {
exists(PathNodeMid sink |
sink.isAtSink() and
node = toNormalSinkNodeEx(sink.getNodeEx()) and
node = sink.toNormalSinkNodeEx() and
state = sink.getState()
)
} or
Expand Down Expand Up @@ -2734,6 +2724,16 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
)
}

/** If this node corresponds to a sink, gets the normal node for that sink. */
pragma[nomagic]
NodeEx toNormalSinkNodeEx() {
exists(Node n |
pragma[only_bind_out](node.asNodeOrImplicitRead()) = n and
(Config::isSink(n) or Config::isSink(n, _)) and
result.asNode() = n
)
}

override PathNodeImpl getASuccessorImpl(string label) {
// an intermediate step to another intermediate node
exists(string l2 | result = this.getSuccMid(l2) |
Expand Down Expand Up @@ -2825,7 +2825,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
PathNodeSink projectToSink(string model) {
this.isAtSink() and
sinkModel(node, model) and
result.getNodeEx() = toNormalSinkNodeEx(node) and
result.getNodeEx() = this.toNormalSinkNodeEx() and
result.getState() = state
}
}
Expand Down
Loading