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

Class DefinitionByReferenceNode

A node that represents the value of a variable after a function call that may have changed the variable because it’s passed by reference.

A typical example would be a call f(&x). Firstly, there will be flow into x from previous definitions of x. Secondly, there will be a DefinitionByReferenceNode to represent the value of x after the call has returned. This node will have its getArgument() equal to &x and its getVariableAccess() equal to x.

Import path

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

Direct supertypes

Indirect supertypes

Inherited fields

Predicates

getArgument

Gets the unconverted argument corresponding to this node.

getParameter

Gets the parameter through which this value is assigned.

Inherited predicates

asConvertedExpr

Gets the expression corresponding to this node, if any. The returned expression may be a Conversion.

from Node
asConvertedExpr

Gets the expression corresponding to this node, if any. The returned expression may be a Conversion.

from Node
asDefiningArgument

Gets the argument that defines this DefinitionByReferenceNode, if any. This predicate should be used instead of asExpr when referring to the value of a reference argument after the call has returned. For example, in f(&x), this predicate will have &x as its result for the Node that represents the new value of x.

from Node
asDefiningArgument

Gets the argument that defines this DefinitionByReferenceNode, if any.

from Node
asDefinition

Gets the definition associated with this node, if any.

from Node
asExpr

Gets the non-conversion expression corresponding to this node, if any. This predicate only has a result on nodes that represent the value of evaluating the expression. For data flowing out of an expression, like when an argument is passed by reference, use asDefiningArgument instead of asExpr.

from Node
asExpr

INTERNAL: Do not use.

from Node
asIndirectArgument

Gets the the argument going into a function for a node that represents the indirect value of the argument after any non-zero number of loads.

from Node
asIndirectArgument

Gets the the argument going into a function for a node that represents the indirect value of the argument after index loads. For example, in: cpp void f(int**); ... int** x = ...; f(x); The node n such that n.asIndirectArgument(1) represents the value of *x going into f, and the node n such that n.asIndirectArgument(2) represents the value of **x going into f.

from Node
asIndirectConvertedExpr

Gets the expression that’s indirectly tracked by this node behind a number of indirections.

from Node
asIndirectConvertedExpr

Gets the expression that’s indirectly tracked by this node behind index number of indirections.

from Node
asIndirectConvertedExpr

INTERNAL: Do not use.

from Node
asIndirectDefinition

Gets the indirect definition at some indirection corresponding to this node, if any.

from Node
asIndirectDefinition

Gets the indirect definition at a given indirection corresponding to this node, if any.

from Node
asIndirectExpr

Gets the non-conversion expression that’s indirectly tracked by this node behind a number of indirections.

from Node
asIndirectExpr

Gets the non-conversion expression that’s indirectly tracked by this node under index number of indirections.

from Node
asIndirectExpr

INTERNAL: Do not use.

from Node
asIndirectVariable

Gets an indirection of this node’s underlying variable, if any.

from Node
asIndirectVariable

Gets the indirectionIndex’th indirection of this node’s underlying variable, if any.

from Node
asInstruction

Gets the instruction corresponding to this node, if any.

from Node
asOperand

Gets the operands corresponding to this node, if any.

from Node
asParameter

Gets the positional parameter corresponding to this node, if any.

from Node
asParameter

Gets the positional parameter corresponding to the node that represents the value of the parameter after index number of loads, if any. For example, in: cpp void f(int** x) { ... } - The node n such that n.asParameter(0) is the parameter x represents the value of x. - The node n such that n.asParameter(1) is the parameter x represents the value of *x. - The node n such that n.asParameter(2) is the parameter x represents the value of **x.

from Node
asPartialDefinition

Gets the expression that is partially defined by this node, if any.

from Node
asUninitialized

Gets the uninitialized local variable corresponding to this node, if any.

from Node
asVariable

Gets the variable corresponding to this node, if any. This can be used for modeling flow in and out of global variables.

from Node
getAddressOperandfrom IndirectArgumentOutNode
getArgumentIndexfrom IndirectArgumentOutNode
getBasicBlock

Gets the basic block of this node, if any.

from Node
getCallInstructionfrom IndirectArgumentOutNode
getDefinedExpr

Gets the expression that is partially defined by this node.

from PostUpdateNodeImpl
getEnclosingCallable

INTERNAL: Do not use.

from PostUpdateNodeImpl
getFunction

Gets the function to which this node belongs, if any.

from PostUpdateNodeImpl
getIndirectionIndex

Gets the indirection index associated with this node.

from PostUpdateNodeImpl
getLocation

Gets the location of this element.

from Node
getLocationImpl

INTERNAL: Do not use.

from PostUpdateNodeImpl
getOperand

Gets the operand associated with this node.

from PostUpdateNodeImpl
getPreUpdateNode

Gets the node before the state update.

from PostUpdateNodeImpl
getStaticCallTargetfrom IndirectArgumentOutNode
getType

Gets the type of this node.

from PostUpdateNode
getTypeBound

Gets an upper bound on the type of this node.

from Node
hasIndexInBlock

Holds if this node is at index i in basic block block.

from Node
hasLocationInfo

Holds if this element is at the specified location. The location spans column startcolumn of line startline to column endcolumn of line endline in file filepath. For more information, see Locations.

from Node
isGLValue

Holds if this node represents a glvalue.

from Node
toString

Gets a textual representation of this element.

from Node
toStringImpl

INTERNAL: Do not use.

from IndirectArgumentOutNode

Charpred