@@ -1468,13 +1468,13 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
1468
1468
* Holds if an external source specification exists for `n` with output specification
1469
1469
* `output` and kind `kind`.
1470
1470
*/
1471
- predicate sourceElement ( Element n , string output , string kind ) ;
1471
+ predicate sourceElement ( Element n , string output , string kind , Provenance provenance ) ;
1472
1472
1473
1473
/**
1474
1474
* Holds if an external sink specification exists for `n` with input specification
1475
1475
* `input` and kind `kind`.
1476
1476
*/
1477
- predicate sinkElement ( Element n , string input , string kind ) ;
1477
+ predicate sinkElement ( Element n , string input , string kind , Provenance provenance ) ;
1478
1478
1479
1479
class SourceOrSinkElement extends Element ;
1480
1480
@@ -1529,8 +1529,8 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
1529
1529
private import SourceSinkInterpretationInput
1530
1530
1531
1531
private predicate sourceSinkSpec ( string spec ) {
1532
- sourceElement ( _, spec , _) or
1533
- sinkElement ( _, spec , _)
1532
+ sourceElement ( _, spec , _, _ ) or
1533
+ sinkElement ( _, spec , _, _ )
1534
1534
}
1535
1535
1536
1536
private module AccessPath = AccessPathSyntax:: AccessPath< sourceSinkSpec / 1 > ;
@@ -1562,7 +1562,7 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
1562
1562
InterpretNode ref , SourceSinkAccessPath output , string kind
1563
1563
) {
1564
1564
exists ( SourceOrSinkElement e |
1565
- sourceElement ( e , output , kind ) and
1565
+ sourceElement ( e , output , kind , _ ) and
1566
1566
if outputNeedsReferenceExt ( output .getToken ( 0 ) )
1567
1567
then e = ref .getCallTarget ( )
1568
1568
else e = ref .asElement ( )
@@ -1576,7 +1576,7 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
1576
1576
1577
1577
private predicate sinkElementRef ( InterpretNode ref , SourceSinkAccessPath input , string kind ) {
1578
1578
exists ( SourceOrSinkElement e |
1579
- sinkElement ( e , input , kind ) and
1579
+ sinkElement ( e , input , kind , _ ) and
1580
1580
if inputNeedsReferenceExt ( input .getToken ( 0 ) )
1581
1581
then e = ref .getCallTarget ( )
1582
1582
else e = ref .asElement ( )
@@ -1691,6 +1691,63 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
1691
1691
interpretInput ( input , input .getNumToken ( ) , ref , node )
1692
1692
)
1693
1693
}
1694
+
1695
+ signature module TestSourceSinkInputSig {
1696
+ /**
1697
+ * A class or source elements relevant for testing.
1698
+ */
1699
+ class RelevantSourceCallable instanceof SourceOrSinkElement {
1700
+ /** Gets the string representation of this callable used by `source/1`. */
1701
+ string getCallableCsv ( ) ;
1702
+ }
1703
+
1704
+ /**
1705
+ * A class or sink elements relevant for testing.
1706
+ */
1707
+ class RelevantSinkCallable instanceof SourceOrSinkElement {
1708
+ /** Gets the string representation of this callable used by `source/1`. */
1709
+ string getCallableCsv ( ) ;
1710
+ }
1711
+ }
1712
+
1713
+ /** Provides query predicates for outputting a set of relevant sources and sinks. */
1714
+ module TestSourceSinkOutput< TestSourceSinkInputSig TestSourceSinkInput> {
1715
+ private import TestSourceSinkInput
1716
+
1717
+ /**
1718
+ * Holds if there exists a relevant source callable with information roughly corresponding to `csv`.
1719
+ * Used for testing.
1720
+ * The syntax is: "namespace;type;overrides;name;signature;ext;outputspec;kind;provenance",
1721
+ * ext is hardcoded to empty.
1722
+ */
1723
+ query predicate source ( string csv ) {
1724
+ exists ( RelevantSourceCallable c , string output , string kind , Provenance provenance |
1725
+ sourceElement ( c , output , kind , provenance ) and
1726
+ csv =
1727
+ c .getCallableCsv ( ) // Callable information
1728
+ + output + ";" // output
1729
+ + kind + ";" // kind
1730
+ + provenance // provenance
1731
+ )
1732
+ }
1733
+
1734
+ /**
1735
+ * Holds if there exists a relevant sink callable with information roughly corresponding to `csv`.
1736
+ * Used for testing.
1737
+ * The syntax is: "namespace;type;overrides;name;signature;ext;inputspec;kind;provenance",
1738
+ * ext is hardcoded to empty.
1739
+ */
1740
+ query predicate sink ( string csv ) {
1741
+ exists ( RelevantSinkCallable c , string input , string kind , Provenance provenance |
1742
+ sinkElement ( c , input , kind , provenance ) and
1743
+ csv =
1744
+ c .getCallableCsv ( ) // Callable information
1745
+ + input + ";" // input
1746
+ + kind + ";" // kind
1747
+ + provenance // provenance
1748
+ )
1749
+ }
1750
+ }
1694
1751
}
1695
1752
}
1696
1753
@@ -1746,7 +1803,8 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
1746
1803
}
1747
1804
1748
1805
/**
1749
- * A query predicate for outputting flow summaries in semi-colon separated format in QL tests.
1806
+ * Holds if there exists a relevant summary callable with information roughly corresponding to `csv`.
1807
+ * Used for testing.
1750
1808
* The syntax is: "namespace;type;overrides;name;signature;ext;inputspec;outputspec;kind;provenance",
1751
1809
* ext is hardcoded to empty.
1752
1810
*/
@@ -1766,7 +1824,8 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
1766
1824
}
1767
1825
1768
1826
/**
1769
- * Holds if a neutral model `csv` exists (semi-colon separated format). Used for testing purposes.
1827
+ * Holds if there exists a relevant neutral callable with information roughly corresponding to `csv`.
1828
+ * Used for testing.
1770
1829
* The syntax is: "namespace;type;name;signature;kind;provenance"",
1771
1830
*/
1772
1831
query predicate neutral ( string csv ) {
0 commit comments