CodeQL library for C/C++
codeql/cpp-all 0.12.12-dev (changelog, source)
Search

Class AdditionalCallTarget

A unit class for adding additional call steps.

Extend this class to add additional call steps to the data flow graph.

For example, if the following subclass is added:

class MyAdditionalCallTarget extends DataFlow::AdditionalCallTarget {
  override Function viableTarget(Call call) {
    call.getTarget().hasName("f") and
    result.hasName("g")
  }
}

then flow from source() to x in sink(x) is reported in the following example:

void sink(int);
int source();
void f(int);

void g(int x) {
  sink(x);
}

void test() {
  int x = source();
  f(x);
}

Note: To prevent reevaluation of cached dataflow-related predicates any subclass of AdditionalCallTarget must be imported in all dataflow queries.

Import path

import semmle.code.cpp.ir.dataflow.internal.DataFlowUtil

Direct supertypes

Indirect supertypes

Predicates

viableTarget

Gets a viable target for call.

Inherited predicates

toString

Gets a textual representation of this element.

from Unit