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

Class SsaDefinition

A definition of one or more SSA variables, including phi node definitions. An SSA variable, as defined in the literature, is effectively the pair of an SsaDefinition d and a StackVariable v, written (d, v) in this documentation. Note that definitions and uses can be coincident due to the presence of parameter definitions and phi nodes.

Not all StackVariables of a function have SSA definitions. If the variable has its address taken, either explicitly or implicitly, then it is excluded from analysis. SsaDefinitions are not generated in locations that are statically seen to be unreachable.

Import path

import cpp

Direct supertypes

Indirect supertypes

Known direct subtypes

Predicates

definedByParameter

Holds if the SSA variable (this, p) is defined by parameter p.

getAPhiInput

Holds if the SSA variable (result, v) is an input to the phi definition (this, v).

getAUse

Gets a use of the SSA variable represented by the pair (this, v).

getAVariable

Gets a variable corresponding to an SSA StackVariable defined by this definition.

getAnUltimateDefiningValue

Gets a possible defining expression for v at this SSA definition, recursing backwards through phi definitions. Not all definitions have a defining expression—see the documentation for getDefiningValue.

getAnUltimateSsaDefinition

Gets a definition that ultimately defines this variable and is not itself a phi node.

getBasicBlock

Gets the BasicBlock containing this definition.

getDefiningValue

Gets the expression assigned to the SSA variable (this, v), if any, when it is not a phi definition. The following is an exhaustive list of expressions that may be the result of this predicate.

getDefinition

Gets the control-flow node for this definition. This will usually be the control-flow node that assigns to this variable as a side effect, but there are some exceptions. If this is defined by initialization, the result is the value of Initializer.getExpr() for that initialization. If this is a function parameter (see definedByParameter), the result will be the function entry point. If this variable is defined by being passed as a reference in a function call, including overloaded operators, the result will be the VariableAccess expression for this parameter. If this is a phi node (see isPhiNode), the result will be the node where control flow is joined from multiple paths.

getLocation

Gets the location of this definition.

isPhiNode

Holds if this definition is a phi node for variable v.

reachesEndOfBB

Holds if (this, v) reaches the end of basic block b.

toString

Gets a string representation of the SSA variable represented by the pair (this, v).

Inherited predicates

getAPrimaryQlClass

Gets the name of a primary CodeQL class to which this element belongs.

from ElementBase
getPrimaryQlClasses

Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.

from ElementBase
toString

Gets a textual representation of this element.

from ElementBase

Charpred