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

Class FlowVar

A conceptual variable that is assigned only once, like an SSA variable. This class is used for tracking data flow through variables, where the desired semantics is sometimes different from what the SSA library provides. Unlike SSA, there are no phi nodes; instead, each VariableAccess may be associated with more than one FlowVar.

Each instance of this class corresponds to a modification or an initial value of a variable. A FlowVar has exactly one result for either definedByExpr or definedByInitialValue. The documentation on those two member predicates explains how a FlowVar relates to syntactic constructs of the language.

Import path

import semmle.code.cpp.dataflow.internal.FlowVar

Direct supertypes

Known direct subtypes

    Predicates

    definedByExpr

    Holds if this FlowVar corresponds to a modification occurring when node is evaluated, receiving a value best described by e. The following is an exhaustive list of cases where this may happen.

    definedByInitialValue

    Holds if this FlowVar corresponds to the initial value of v. The following is an exhaustive list of cases where this may happen.

    definedPartiallyAt

    Holds if this FlowVar is a PartialDefinition whose outer defined expression is e. For example, in f(&x), the outer defined expression is &x.

    getAnAccess

    Gets a VariableAccess that may take its value from this. Consider the following snippet.

    getLocation

    Gets the location of this element.

    reachesRefParameter

    Holds if this FlowVar is a definition of a reference parameter p that persists until the function returns.

    toString

    Gets a textual representation of this element.