Skip to content

Commit 8ade724

Browse files
authored
Merge pull request github#12885 from michaelnebel/mergepathgraph3
Dataflow: Introduce param module for merging three path graphs.
2 parents bfbbb52 + 656d8d2 commit 8ade724

File tree

8 files changed

+392
-0
lines changed

8 files changed

+392
-0
lines changed

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,52 @@ module MergePathGraph<
361361
}
362362
}
363363
}
364+
365+
/**
366+
* Constructs a `PathGraph` from three `PathGraph`s by disjoint union.
367+
*/
368+
module MergePathGraph3<
369+
PathNodeSig PathNode1, PathNodeSig PathNode2, PathNodeSig PathNode3,
370+
PathGraphSig<PathNode1> Graph1, PathGraphSig<PathNode2> Graph2, PathGraphSig<PathNode3> Graph3>
371+
{
372+
private module MergedInner = MergePathGraph<PathNode1, PathNode2, Graph1, Graph2>;
373+
374+
private module Merged =
375+
MergePathGraph<MergedInner::PathNode, PathNode3, MergedInner::PathGraph, Graph3>;
376+
377+
/** A node in a graph of path explanations that is formed by disjoint union of the three given graphs. */
378+
class PathNode instanceof Merged::PathNode {
379+
/** Gets this as a projection on the first given `PathGraph`. */
380+
PathNode1 asPathNode1() { result = super.asPathNode1().asPathNode1() }
381+
382+
/** Gets this as a projection on the second given `PathGraph`. */
383+
PathNode2 asPathNode2() { result = super.asPathNode1().asPathNode2() }
384+
385+
/** Gets this as a projection on the third given `PathGraph`. */
386+
PathNode3 asPathNode3() { result = super.asPathNode2() }
387+
388+
/** Gets a textual representation of this element. */
389+
string toString() { result = super.toString() }
390+
391+
/**
392+
* Holds if this element is at the specified location.
393+
* The location spans column `startcolumn` of line `startline` to
394+
* column `endcolumn` of line `endline` in file `filepath`.
395+
* For more information, see
396+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
397+
*/
398+
predicate hasLocationInfo(
399+
string filepath, int startline, int startcolumn, int endline, int endcolumn
400+
) {
401+
super.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
402+
}
403+
404+
/** Gets the underlying `Node`. */
405+
Node getNode() { result = super.getNode() }
406+
}
407+
408+
/**
409+
* Provides the query predicates needed to include a graph in a path-problem query.
410+
*/
411+
module PathGraph = Merged::PathGraph;
412+
}

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlow.qll

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,52 @@ module MergePathGraph<
361361
}
362362
}
363363
}
364+
365+
/**
366+
* Constructs a `PathGraph` from three `PathGraph`s by disjoint union.
367+
*/
368+
module MergePathGraph3<
369+
PathNodeSig PathNode1, PathNodeSig PathNode2, PathNodeSig PathNode3,
370+
PathGraphSig<PathNode1> Graph1, PathGraphSig<PathNode2> Graph2, PathGraphSig<PathNode3> Graph3>
371+
{
372+
private module MergedInner = MergePathGraph<PathNode1, PathNode2, Graph1, Graph2>;
373+
374+
private module Merged =
375+
MergePathGraph<MergedInner::PathNode, PathNode3, MergedInner::PathGraph, Graph3>;
376+
377+
/** A node in a graph of path explanations that is formed by disjoint union of the three given graphs. */
378+
class PathNode instanceof Merged::PathNode {
379+
/** Gets this as a projection on the first given `PathGraph`. */
380+
PathNode1 asPathNode1() { result = super.asPathNode1().asPathNode1() }
381+
382+
/** Gets this as a projection on the second given `PathGraph`. */
383+
PathNode2 asPathNode2() { result = super.asPathNode1().asPathNode2() }
384+
385+
/** Gets this as a projection on the third given `PathGraph`. */
386+
PathNode3 asPathNode3() { result = super.asPathNode2() }
387+
388+
/** Gets a textual representation of this element. */
389+
string toString() { result = super.toString() }
390+
391+
/**
392+
* Holds if this element is at the specified location.
393+
* The location spans column `startcolumn` of line `startline` to
394+
* column `endcolumn` of line `endline` in file `filepath`.
395+
* For more information, see
396+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
397+
*/
398+
predicate hasLocationInfo(
399+
string filepath, int startline, int startcolumn, int endline, int endcolumn
400+
) {
401+
super.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
402+
}
403+
404+
/** Gets the underlying `Node`. */
405+
Node getNode() { result = super.getNode() }
406+
}
407+
408+
/**
409+
* Provides the query predicates needed to include a graph in a path-problem query.
410+
*/
411+
module PathGraph = Merged::PathGraph;
412+
}

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,52 @@ module MergePathGraph<
361361
}
362362
}
363363
}
364+
365+
/**
366+
* Constructs a `PathGraph` from three `PathGraph`s by disjoint union.
367+
*/
368+
module MergePathGraph3<
369+
PathNodeSig PathNode1, PathNodeSig PathNode2, PathNodeSig PathNode3,
370+
PathGraphSig<PathNode1> Graph1, PathGraphSig<PathNode2> Graph2, PathGraphSig<PathNode3> Graph3>
371+
{
372+
private module MergedInner = MergePathGraph<PathNode1, PathNode2, Graph1, Graph2>;
373+
374+
private module Merged =
375+
MergePathGraph<MergedInner::PathNode, PathNode3, MergedInner::PathGraph, Graph3>;
376+
377+
/** A node in a graph of path explanations that is formed by disjoint union of the three given graphs. */
378+
class PathNode instanceof Merged::PathNode {
379+
/** Gets this as a projection on the first given `PathGraph`. */
380+
PathNode1 asPathNode1() { result = super.asPathNode1().asPathNode1() }
381+
382+
/** Gets this as a projection on the second given `PathGraph`. */
383+
PathNode2 asPathNode2() { result = super.asPathNode1().asPathNode2() }
384+
385+
/** Gets this as a projection on the third given `PathGraph`. */
386+
PathNode3 asPathNode3() { result = super.asPathNode2() }
387+
388+
/** Gets a textual representation of this element. */
389+
string toString() { result = super.toString() }
390+
391+
/**
392+
* Holds if this element is at the specified location.
393+
* The location spans column `startcolumn` of line `startline` to
394+
* column `endcolumn` of line `endline` in file `filepath`.
395+
* For more information, see
396+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
397+
*/
398+
predicate hasLocationInfo(
399+
string filepath, int startline, int startcolumn, int endline, int endcolumn
400+
) {
401+
super.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
402+
}
403+
404+
/** Gets the underlying `Node`. */
405+
Node getNode() { result = super.getNode() }
406+
}
407+
408+
/**
409+
* Provides the query predicates needed to include a graph in a path-problem query.
410+
*/
411+
module PathGraph = Merged::PathGraph;
412+
}

go/ql/lib/semmle/go/dataflow/internal/DataFlow.qll

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,52 @@ module MergePathGraph<
361361
}
362362
}
363363
}
364+
365+
/**
366+
* Constructs a `PathGraph` from three `PathGraph`s by disjoint union.
367+
*/
368+
module MergePathGraph3<
369+
PathNodeSig PathNode1, PathNodeSig PathNode2, PathNodeSig PathNode3,
370+
PathGraphSig<PathNode1> Graph1, PathGraphSig<PathNode2> Graph2, PathGraphSig<PathNode3> Graph3>
371+
{
372+
private module MergedInner = MergePathGraph<PathNode1, PathNode2, Graph1, Graph2>;
373+
374+
private module Merged =
375+
MergePathGraph<MergedInner::PathNode, PathNode3, MergedInner::PathGraph, Graph3>;
376+
377+
/** A node in a graph of path explanations that is formed by disjoint union of the three given graphs. */
378+
class PathNode instanceof Merged::PathNode {
379+
/** Gets this as a projection on the first given `PathGraph`. */
380+
PathNode1 asPathNode1() { result = super.asPathNode1().asPathNode1() }
381+
382+
/** Gets this as a projection on the second given `PathGraph`. */
383+
PathNode2 asPathNode2() { result = super.asPathNode1().asPathNode2() }
384+
385+
/** Gets this as a projection on the third given `PathGraph`. */
386+
PathNode3 asPathNode3() { result = super.asPathNode2() }
387+
388+
/** Gets a textual representation of this element. */
389+
string toString() { result = super.toString() }
390+
391+
/**
392+
* Holds if this element is at the specified location.
393+
* The location spans column `startcolumn` of line `startline` to
394+
* column `endcolumn` of line `endline` in file `filepath`.
395+
* For more information, see
396+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
397+
*/
398+
predicate hasLocationInfo(
399+
string filepath, int startline, int startcolumn, int endline, int endcolumn
400+
) {
401+
super.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
402+
}
403+
404+
/** Gets the underlying `Node`. */
405+
Node getNode() { result = super.getNode() }
406+
}
407+
408+
/**
409+
* Provides the query predicates needed to include a graph in a path-problem query.
410+
*/
411+
module PathGraph = Merged::PathGraph;
412+
}

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,52 @@ module MergePathGraph<
361361
}
362362
}
363363
}
364+
365+
/**
366+
* Constructs a `PathGraph` from three `PathGraph`s by disjoint union.
367+
*/
368+
module MergePathGraph3<
369+
PathNodeSig PathNode1, PathNodeSig PathNode2, PathNodeSig PathNode3,
370+
PathGraphSig<PathNode1> Graph1, PathGraphSig<PathNode2> Graph2, PathGraphSig<PathNode3> Graph3>
371+
{
372+
private module MergedInner = MergePathGraph<PathNode1, PathNode2, Graph1, Graph2>;
373+
374+
private module Merged =
375+
MergePathGraph<MergedInner::PathNode, PathNode3, MergedInner::PathGraph, Graph3>;
376+
377+
/** A node in a graph of path explanations that is formed by disjoint union of the three given graphs. */
378+
class PathNode instanceof Merged::PathNode {
379+
/** Gets this as a projection on the first given `PathGraph`. */
380+
PathNode1 asPathNode1() { result = super.asPathNode1().asPathNode1() }
381+
382+
/** Gets this as a projection on the second given `PathGraph`. */
383+
PathNode2 asPathNode2() { result = super.asPathNode1().asPathNode2() }
384+
385+
/** Gets this as a projection on the third given `PathGraph`. */
386+
PathNode3 asPathNode3() { result = super.asPathNode2() }
387+
388+
/** Gets a textual representation of this element. */
389+
string toString() { result = super.toString() }
390+
391+
/**
392+
* Holds if this element is at the specified location.
393+
* The location spans column `startcolumn` of line `startline` to
394+
* column `endcolumn` of line `endline` in file `filepath`.
395+
* For more information, see
396+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
397+
*/
398+
predicate hasLocationInfo(
399+
string filepath, int startline, int startcolumn, int endline, int endcolumn
400+
) {
401+
super.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
402+
}
403+
404+
/** Gets the underlying `Node`. */
405+
Node getNode() { result = super.getNode() }
406+
}
407+
408+
/**
409+
* Provides the query predicates needed to include a graph in a path-problem query.
410+
*/
411+
module PathGraph = Merged::PathGraph;
412+
}

python/ql/lib/semmle/python/dataflow/new/internal/DataFlow.qll

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,52 @@ module MergePathGraph<
361361
}
362362
}
363363
}
364+
365+
/**
366+
* Constructs a `PathGraph` from three `PathGraph`s by disjoint union.
367+
*/
368+
module MergePathGraph3<
369+
PathNodeSig PathNode1, PathNodeSig PathNode2, PathNodeSig PathNode3,
370+
PathGraphSig<PathNode1> Graph1, PathGraphSig<PathNode2> Graph2, PathGraphSig<PathNode3> Graph3>
371+
{
372+
private module MergedInner = MergePathGraph<PathNode1, PathNode2, Graph1, Graph2>;
373+
374+
private module Merged =
375+
MergePathGraph<MergedInner::PathNode, PathNode3, MergedInner::PathGraph, Graph3>;
376+
377+
/** A node in a graph of path explanations that is formed by disjoint union of the three given graphs. */
378+
class PathNode instanceof Merged::PathNode {
379+
/** Gets this as a projection on the first given `PathGraph`. */
380+
PathNode1 asPathNode1() { result = super.asPathNode1().asPathNode1() }
381+
382+
/** Gets this as a projection on the second given `PathGraph`. */
383+
PathNode2 asPathNode2() { result = super.asPathNode1().asPathNode2() }
384+
385+
/** Gets this as a projection on the third given `PathGraph`. */
386+
PathNode3 asPathNode3() { result = super.asPathNode2() }
387+
388+
/** Gets a textual representation of this element. */
389+
string toString() { result = super.toString() }
390+
391+
/**
392+
* Holds if this element is at the specified location.
393+
* The location spans column `startcolumn` of line `startline` to
394+
* column `endcolumn` of line `endline` in file `filepath`.
395+
* For more information, see
396+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
397+
*/
398+
predicate hasLocationInfo(
399+
string filepath, int startline, int startcolumn, int endline, int endcolumn
400+
) {
401+
super.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
402+
}
403+
404+
/** Gets the underlying `Node`. */
405+
Node getNode() { result = super.getNode() }
406+
}
407+
408+
/**
409+
* Provides the query predicates needed to include a graph in a path-problem query.
410+
*/
411+
module PathGraph = Merged::PathGraph;
412+
}

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlow.qll

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,52 @@ module MergePathGraph<
361361
}
362362
}
363363
}
364+
365+
/**
366+
* Constructs a `PathGraph` from three `PathGraph`s by disjoint union.
367+
*/
368+
module MergePathGraph3<
369+
PathNodeSig PathNode1, PathNodeSig PathNode2, PathNodeSig PathNode3,
370+
PathGraphSig<PathNode1> Graph1, PathGraphSig<PathNode2> Graph2, PathGraphSig<PathNode3> Graph3>
371+
{
372+
private module MergedInner = MergePathGraph<PathNode1, PathNode2, Graph1, Graph2>;
373+
374+
private module Merged =
375+
MergePathGraph<MergedInner::PathNode, PathNode3, MergedInner::PathGraph, Graph3>;
376+
377+
/** A node in a graph of path explanations that is formed by disjoint union of the three given graphs. */
378+
class PathNode instanceof Merged::PathNode {
379+
/** Gets this as a projection on the first given `PathGraph`. */
380+
PathNode1 asPathNode1() { result = super.asPathNode1().asPathNode1() }
381+
382+
/** Gets this as a projection on the second given `PathGraph`. */
383+
PathNode2 asPathNode2() { result = super.asPathNode1().asPathNode2() }
384+
385+
/** Gets this as a projection on the third given `PathGraph`. */
386+
PathNode3 asPathNode3() { result = super.asPathNode2() }
387+
388+
/** Gets a textual representation of this element. */
389+
string toString() { result = super.toString() }
390+
391+
/**
392+
* Holds if this element is at the specified location.
393+
* The location spans column `startcolumn` of line `startline` to
394+
* column `endcolumn` of line `endline` in file `filepath`.
395+
* For more information, see
396+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
397+
*/
398+
predicate hasLocationInfo(
399+
string filepath, int startline, int startcolumn, int endline, int endcolumn
400+
) {
401+
super.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
402+
}
403+
404+
/** Gets the underlying `Node`. */
405+
Node getNode() { result = super.getNode() }
406+
}
407+
408+
/**
409+
* Provides the query predicates needed to include a graph in a path-problem query.
410+
*/
411+
module PathGraph = Merged::PathGraph;
412+
}

0 commit comments

Comments
 (0)