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

Class TypeTracking::TypeTracker

A summary of the steps needed to track a value to a given dataflow node.

This can be used to track objects that implement a certain API in order to recognize calls to that API. Note that type-tracking does not by itself provide a source/sink relation, that is, it may determine that a node has a given type, but it won’t determine where that type came from.

It is recommended that all uses of this type are written in the following form, for tracking some type myType:

Node myType(TypeTracker tt) {
  tt.start() and
  result = < source of myType >
  or
  exists(TypeTracker tt2 |
    tt = tt2.step(myType(tt2), result)
  )
}

Node myType() { myType(TypeTracker::end()).flowsTo(result) }

If you want to track individual intra-procedural steps, use tt2.smallstep instead of tt2.step.

Import path

import codeql.typetracking.internal.TypeTrackingImpl

Direct supertypes

Predicates

call

Holds if this is the starting point of type tracking when tracking a parameter into a call, but not out of it.

continue

Gets a type tracker that starts where this one has left off to allow continued tracking.

end

Holds if this is the end point of type tracking.

getContent

INTERNAL. DO NOT USE.

smallstep

Gets the summary that corresponds to having taken a forwards local, heap and/or inter-procedural step from nodeFrom to nodeTo.

start

Holds if this is the starting point of type tracking.

startInContent

Holds if this is the starting point of type tracking, and the value starts in the content named contentName. The type tracking only ends after the content has been loaded.

step

Gets the summary that corresponds to having taken a forwards heap and/or inter-procedural step from nodeFrom to nodeTo.

toString

Gets a textual representation of this summary.

Charpred