Skip to content

Commit 0724151

Browse files
committed
Rust: add some QLdoc for optional steps/barriers
1 parent 954c0e8 commit 0724151

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

rust/ql/lib/codeql/rust/dataflow/internal/Content.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ final class SingletonContentSet extends ContentSet, TSingletonContentSet {
214214
override Content getAReadContent() { result = c }
215215
}
216216

217+
/**
218+
* A step in a flow summary defined using `OptionalStep[name]`. An `OptionalStep` is "opt-in", which means
219+
* that by default the step is not present in the flow summary and needs to be explicitly enabled by defining
220+
* an additional flow step.
221+
*/
217222
final class OptionalStep extends ContentSet, TOptionalStep {
218223
override string toString() {
219224
exists(string name |
@@ -227,6 +232,10 @@ final class OptionalStep extends ContentSet, TOptionalStep {
227232
override Content getAReadContent() { none() }
228233
}
229234

235+
/**
236+
* A step in a flow summary defined using `OptionalBarrier[name]`. An `OptionalBarrier` is "opt-out", by default
237+
* data can flow freely through the step. Flow through the step can be explicity blocked by defining its node as a barrier.
238+
*/
230239
final class OptionalBarrier extends ContentSet, TOptionalBarrier {
231240
override string toString() {
232241
exists(string name |

rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,11 @@ import Cached
11331133

11341134
cached
11351135
private module OptionalSteps {
1136+
/**
1137+
* A step in a flow summary defined using `OptionalStep[name]`. An `OptionalStep` is "opt-in", which means
1138+
* that by default the step is not present in the flow summary and needs to be explicitly enabled by defining
1139+
* an additional flow step.
1140+
*/
11361141
cached
11371142
predicate optionalStep(Node node1, string name, Node node2) {
11381143
FlowSummaryImpl::Private::Steps::summaryReadStep(node1.(FlowSummaryNode).getSummaryNode(),
@@ -1141,6 +1146,10 @@ private module OptionalSteps {
11411146
TOptionalStep(name), node2.(FlowSummaryNode).getSummaryNode())
11421147
}
11431148

1149+
/**
1150+
* A step in a flow summary defined using `OptionalBarrier[name]`. An `OptionalBarrier` is "opt-out", by default
1151+
* data can flow freely through the step. Flow through the step can be explicity blocked by defining its node as a barrier.
1152+
*/
11441153
cached
11451154
predicate optionalBarrier(Node node, string name) {
11461155
FlowSummaryImpl::Private::Steps::summaryReadStep(_, TOptionalBarrier(name),

0 commit comments

Comments
 (0)