Skip to content

Commit 49dbb8c

Browse files
authored
Docs: Mention hasPartialFlowRev and performance problem
The things that I mentioned in github#6502 (comment) that never got into the document 😳
1 parent dfd30e4 commit 49dbb8c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/codeql/writing-codeql-queries/debugging-data-flow-queries-using-partial-flow.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ To avoid these problems, a data-flow ``Configuration`` comes with a mechanism fo
7878
*/
7979
final predicate hasPartialFlow(PartialPathNode source, PartialPathNode node, int dist) {
8080
81+
There is also a ``Configuration.hasPartialFlowRev`` for exploring flow backwards from a sink.
82+
8183
As noted in the documentation for ``hasPartialFlow`` (for example, in the
8284
`CodeQL for Java documentation <https://codeql.github.com/codeql-standard-libraries/java/semmle/code/java/dataflow/internal/DataFlowImpl2.qll/predicate.DataFlowImpl2$Configuration$hasPartialFlow.3.html>`__) you must first enable this by adding an override of ``explorationLimit``. For example:
8385

@@ -87,6 +89,8 @@ As noted in the documentation for ``hasPartialFlow`` (for example, in the
8789
8890
This defines the exploration radius within which ``hasPartialFlow`` returns results.
8991

92+
To get good performance when using ``hasPartialFlow`` it is important to ensure the ``isSink`` predicate of the configuration has no results. Likewise when using ``hasPartialFlowRev`` the ``isSource`` predicate of the configuration should have no results
93+
9094
It is also useful to focus on a single source at a time as the starting point for the flow exploration. This is most easily done by adding a temporary restriction in the ``isSource`` predicate.
9195

9296
To do quick evaluations of partial flow it is often easiest to add a predicate to the query that is solely intended for quick evaluation (right-click the predicate name and choose "CodeQL: Quick Evaluation"). A good starting point is something like:
@@ -113,4 +117,4 @@ Further reading
113117
----------------
114118

115119
- :ref:`About data flow analysis <about-data-flow-analysis>`
116-
- :ref:`Creating path queries <creating-path-queries>`
120+
- :ref:`Creating path queries <creating-path-queries>`

0 commit comments

Comments
 (0)