Skip to content

Commit

Permalink
Rename {Source,Sink}Node to {Source,Sink}Element
Browse files Browse the repository at this point in the history
  • Loading branch information
hvitved committed Jan 8, 2025
1 parent 1b31c90 commit 868caf9
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ private module TypesInput implements Impl::Private::TypesInputSig {
)
}

DataFlowType getSourceNodeType(Input::SourceBase source, Impl::Private::SummaryComponent sc) {
DataFlowType getSourceType(Input::SourceBase source, Impl::Private::SummaryComponent sc) {
none()
}

DataFlowType getSinkNodeType(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
DataFlowType getSinkType(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
}

private module StepsInput implements Impl::Private::StepsInputSig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ private module TypesInput implements Impl::Private::TypesInputSig {
exists(rk)
}

DataFlowType getSourceNodeType(Input::SourceBase source, Impl::Private::SummaryComponent sc) {
DataFlowType getSourceType(Input::SourceBase source, Impl::Private::SummaryComponent sc) {
none()
}

DataFlowType getSinkNodeType(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
DataFlowType getSinkType(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
}

private module StepsInput implements Impl::Private::StepsInputSig {
Expand Down
2 changes: 1 addition & 1 deletion rust/ql/lib/codeql/rust/dataflow/FlowSink.qll
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ private module Sinks {
/** Provides the `Range` class used to define the extent of `FlowSink`. */
module FlowSink {
/** A flow source. */
abstract class Range extends Impl::Public::SinkNode {
abstract class Range extends Impl::Public::SinkElement {
bindingset[this]
Range() { any() }

Expand Down
2 changes: 1 addition & 1 deletion rust/ql/lib/codeql/rust/dataflow/FlowSource.qll
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ private module Sources {
/** Provides the `Range` class used to define the extent of `FlowSource`. */
module FlowSource {
/** A flow source. */
abstract class Range extends Impl::Public::SourceNode {
abstract class Range extends Impl::Public::SourceElement {
bindingset[this]
Range() { any() }

Expand Down
20 changes: 11 additions & 9 deletions rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,15 @@ module Node {
result = this.getSummaryNode().getSummarizedCallable()
}

/** Gets the source node that this node belongs to, if any */
FlowSummaryImpl::Public::SourceNode getSourceNode() {
result = this.getSummaryNode().getSourceNode()
/** Gets the AST source node that this node belongs to, if any */
FlowSummaryImpl::Public::SourceElement getSourceElement() {
result = this.getSummaryNode().getSourceElement()
}

/** Gets the sink node that this node belongs to, if any */
FlowSummaryImpl::Public::SinkNode getSinkNode() { result = this.getSummaryNode().getSinkNode() }
/** Gets the AST sink node that this node belongs to, if any */
FlowSummaryImpl::Public::SinkElement getSinkElement() {
result = this.getSummaryNode().getSinkElement()
}

/** Holds is this node is a source node of kind `kind`. */
predicate isSource(string kind) {
Expand All @@ -210,9 +212,9 @@ module Node {
}

override CfgScope getCfgScope() {
result = this.getSummaryNode().getSourceNode().getEnclosingCfgScope()
result = this.getSummaryNode().getSourceElement().getEnclosingCfgScope()
or
result = this.getSummaryNode().getSinkNode().getEnclosingCfgScope()
result = this.getSummaryNode().getSinkElement().getEnclosingCfgScope()
}

override DataFlowCallable getEnclosingCallable() {
Expand All @@ -225,9 +227,9 @@ module Node {
exists(this.getSummarizedCallable()) and
result instanceof EmptyLocation
or
result = this.getSourceNode().getLocation()
result = this.getSourceElement().getLocation()
or
result = this.getSinkNode().getLocation()
result = this.getSinkElement().getLocation()
}

override string toString() { result = this.getSummaryNode().toString() }
Expand Down
2 changes: 1 addition & 1 deletion rust/ql/lib/utils/test/InlineFlowTest.qll
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private module FlowTestImpl implements InputSig<Location, RustDataFlow> {
or
sourceNode(src, _) and
exists(CallExprBase call |
call = src.(Node::FlowSummaryNode).getSourceNode().getCall() and
call = src.(Node::FlowSummaryNode).getSourceElement().getCall() and
result = call.getArgList().getArg(0).toString()
)
}
Expand Down
Loading

0 comments on commit 868caf9

Please sign in to comment.