@@ -278,47 +278,72 @@ signature module PathGraphSig<PathNodeSig PathNode> {
278
278
predicate subpaths ( PathNode arg , PathNode par , PathNode ret , PathNode out ) ;
279
279
}
280
280
281
+ /**
282
+ * Constructs a `PathGraph` from two `PathGraph`s by disjoint union.
283
+ */
281
284
module MergePathGraph<
282
285
PathNodeSig PathNode1, PathNodeSig PathNode2, PathGraphSig< PathNode1 > Graph1,
283
286
PathGraphSig< PathNode2 > Graph2> {
284
287
private newtype TPathNode =
285
288
TPathNode1 ( PathNode1 p ) or
286
289
TPathNode2 ( PathNode2 p )
287
290
291
+ /** A node in a graph of path explanations that is formed by disjoint union of the two given graphs. */
288
292
class PathNode extends TPathNode {
293
+ /** Gets this as a projection on the first given `PathGraph`. */
289
294
PathNode1 asPathNode1 ( ) { this = TPathNode1 ( result ) }
290
295
296
+ /** Gets this as a projection on the second given `PathGraph`. */
291
297
PathNode2 asPathNode2 ( ) { this = TPathNode2 ( result ) }
292
298
299
+ /** Gets a textual representation of this element. */
293
300
string toString ( ) {
294
301
result = this .asPathNode1 ( ) .toString ( ) or
295
302
result = this .asPathNode2 ( ) .toString ( )
296
303
}
297
304
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
+ */
298
312
predicate hasLocationInfo (
299
313
string filepath , int startline , int startcolumn , int endline , int endcolumn
300
314
) {
301
315
this .asPathNode1 ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn ) or
302
316
this .asPathNode2 ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
303
317
}
304
318
319
+ /** Gets the underlying `Node`. */
305
320
Node getNode ( ) {
306
321
result = this .asPathNode1 ( ) .getNode ( ) or
307
322
result = this .asPathNode2 ( ) .getNode ( )
308
323
}
309
324
}
310
325
326
+ /**
327
+ * Provides the query predicates needed to include a graph in a path-problem query.
328
+ */
311
329
module PathGraph implements PathGraphSig< PathNode > {
330
+ /** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */
312
331
query predicate edges ( PathNode a , PathNode b ) {
313
332
Graph1:: edges ( a .asPathNode1 ( ) , b .asPathNode1 ( ) ) or
314
333
Graph2:: edges ( a .asPathNode2 ( ) , b .asPathNode2 ( ) )
315
334
}
316
335
336
+ /** Holds if `n` is a node in the graph of data flow path explanations. */
317
337
query predicate nodes ( PathNode n , string key , string val ) {
318
338
Graph1:: nodes ( n .asPathNode1 ( ) , key , val ) or
319
339
Graph2:: nodes ( n .asPathNode2 ( ) , key , val )
320
340
}
321
341
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
+ */
322
347
query predicate subpaths ( PathNode arg , PathNode par , PathNode ret , PathNode out ) {
323
348
Graph1:: subpaths ( arg .asPathNode1 ( ) , par .asPathNode1 ( ) , ret .asPathNode1 ( ) , out .asPathNode1 ( ) ) or
324
349
Graph2:: subpaths ( arg .asPathNode2 ( ) , par .asPathNode2 ( ) , ret .asPathNode2 ( ) , out .asPathNode2 ( ) )
0 commit comments