Skip to content

Commit 26a6653

Browse files
committed
C++: Add QLDoc.
1 parent 140ff53 commit 26a6653

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,6 +2243,34 @@ module InstructionBarrierGuard<instructionGuardChecksSig/3 instructionGuardCheck
22432243
* A unit class for adding additional call steps.
22442244
*
22452245
* Extend this class to add additional call steps to the data flow graph.
2246+
*
2247+
* For example, if the following subclass is added:
2248+
* ```ql
2249+
* class MyAdditionalCallTarget extends DataFlow::AdditionalCallTarget {
2250+
* override Function viableTarget(Call call) {
2251+
* call.getTarget().hasName("f") and
2252+
* result.hasName("g")
2253+
* }
2254+
* }
2255+
* ```
2256+
* then flow from `source()` to `x` in `sink(x)` is reported in the following example:
2257+
* ```cpp
2258+
* void sink(int);
2259+
* int source();
2260+
* void f(int);
2261+
*
2262+
* void g(int x) {
2263+
* sink(x);
2264+
* }
2265+
*
2266+
* void test() {
2267+
* int x = source();
2268+
* f(x);
2269+
* }
2270+
* ```
2271+
*
2272+
* Note: To prevent reevaluation of cached dataflow-related predicates any
2273+
* subclass of `AdditionalCallTarget` must be imported in all dataflow queries.
22462274
*/
22472275
class AdditionalCallTarget extends Unit {
22482276
/**

0 commit comments

Comments
 (0)