Provides classes and predicates for reasoning about definitions and uses of variables.
Import path
import semmle.code.cpp.controlflow.DefinitionsAndUses
Imports
cpp | Provides classes and predicates for working with C/C++ code.
|
Predicates
definition | Holds if def is a (potential) assignment to stack variable v . That is, the variable may hold another value in the control-flow node(s) following def than before.
|
definitionBarrier | Holds if barrier is either a (potential) definition of v or follows an access that gets the address of v . In both cases, the value of v after barrier cannot be assumed to be the same as before.
|
definitionByReference | Holds if va is a variable passed by reference as argument def , where the callee potentially assigns the corresponding parameter. The definitions-and-uses library models assignment by reference as if it happens on evaluation of the argument, def .
|
definitionReaches | Holds if the definition def of some stack variable can reach node , which is a definition or use, without crossing definitions of the same variable.
|
definitionUsePair | Computed relation: A “definition-use-pair” for a particular variable. Intuitively, this means that def is an assignment to var , and use is a read of var at which the value assigned by def may be read. (There can be more than one definition reaching a single use, and a single definition can reach many uses.)
|
exprDefinition | Holds if def is a (definite) assignment to the stack variable v . e is the assigned expression.
|
parameterUsePair | Holds if va is a use of the parameter p that could observe the passed-in value.
|
useOfVar | Holds if use is a non-definition use of stack variable v . This will not include accesses on the LHS of an assignment (which don’t retrieve the variable value), but will include accesses in increment/decrement operations.
|
useOfVarActual | Same as useOfVar(v, use) , but with the extra condition that the access use actually reads the value of the stack variable v at run-time. (Non-examples include &x and function calls where the callee does not use the relevant parameter.)
|
useUsePair | A use/use pair is a pair of uses of a particular variable var where the same value might be read (meaning that there is a control-flow path from first to second without crossing a definition of var ).
|
Classes
Def | A definition of a stack variable.
|
DefOrUse | Utility class: A definition or use of a stack variable.
|
ParameterDef | A definition of a parameter.
|
Use | A use of a stack variable.
|