Skip to content

Commit a836444

Browse files
committed
Dataflow: Add some qldoc.
1 parent 00f0879 commit a836444

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

java/ql/lib/semmle/code/java/dataflow/internal/DataFlow.qll

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,47 +278,72 @@ signature module PathGraphSig<PathNodeSig PathNode> {
278278
predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out);
279279
}
280280

281+
/**
282+
* Constructs a `PathGraph` from two `PathGraph`s by disjoint union.
283+
*/
281284
module MergePathGraph<
282285
PathNodeSig PathNode1, PathNodeSig PathNode2, PathGraphSig<PathNode1> Graph1,
283286
PathGraphSig<PathNode2> Graph2> {
284287
private newtype TPathNode =
285288
TPathNode1(PathNode1 p) or
286289
TPathNode2(PathNode2 p)
287290

291+
/** A node in a graph of path explanations that is formed by disjoint union of the two given graphs. */
288292
class PathNode extends TPathNode {
293+
/** Gets this as a projection on the first given `PathGraph`. */
289294
PathNode1 asPathNode1() { this = TPathNode1(result) }
290295

296+
/** Gets this as a projection on the second given `PathGraph`. */
291297
PathNode2 asPathNode2() { this = TPathNode2(result) }
292298

299+
/** Gets a textual representation of this element. */
293300
string toString() {
294301
result = this.asPathNode1().toString() or
295302
result = this.asPathNode2().toString()
296303
}
297304

305+
/**
306+
* Holds if this element is at the specified location.
307+
* The location spans column `startcolumn` of line `startline` to
308+
* column `endcolumn` of line `endline` in file `filepath`.
309+
* For more information, see
310+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
311+
*/
298312
predicate hasLocationInfo(
299313
string filepath, int startline, int startcolumn, int endline, int endcolumn
300314
) {
301315
this.asPathNode1().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) or
302316
this.asPathNode2().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
303317
}
304318

319+
/** Gets the underlying `Node`. */
305320
Node getNode() {
306321
result = this.asPathNode1().getNode() or
307322
result = this.asPathNode2().getNode()
308323
}
309324
}
310325

326+
/**
327+
* Provides the query predicates needed to include a graph in a path-problem query.
328+
*/
311329
module PathGraph implements PathGraphSig<PathNode> {
330+
/** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */
312331
query predicate edges(PathNode a, PathNode b) {
313332
Graph1::edges(a.asPathNode1(), b.asPathNode1()) or
314333
Graph2::edges(a.asPathNode2(), b.asPathNode2())
315334
}
316335

336+
/** Holds if `n` is a node in the graph of data flow path explanations. */
317337
query predicate nodes(PathNode n, string key, string val) {
318338
Graph1::nodes(n.asPathNode1(), key, val) or
319339
Graph2::nodes(n.asPathNode2(), key, val)
320340
}
321341

342+
/**
343+
* Holds if `(arg, par, ret, out)` forms a subpath-tuple, that is, flow through
344+
* a subpath between `par` and `ret` with the connecting edges `arg -> par` and
345+
* `ret -> out` is summarized as the edge `arg -> out`.
346+
*/
322347
query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) {
323348
Graph1::subpaths(arg.asPathNode1(), par.asPathNode1(), ret.asPathNode1(), out.asPathNode1()) or
324349
Graph2::subpaths(arg.asPathNode2(), par.asPathNode2(), ret.asPathNode2(), out.asPathNode2())

0 commit comments

Comments
 (0)