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

Member predicate Instruction::isGLValue

Holds if the result produced by this instruction is a glvalue. If this holds, the result of the instruction represents the address of a location, and the type of the location is given by getResultType(). If this does not hold, the result of the instruction represents a value whose type is given by getResultType().

For example, the statement y = x; generates the following IR:

r1_0(glval: int) = VariableAddress[x]
r1_1(int)        = Load r1_0, mu0_1
r1_2(glval: int) = VariableAddress[y]
mu1_3(int)       = Store r1_2, r1_1

The result of each VariableAddress instruction is a glvalue of type int, representing the address of the corresponding integer variable. The result of the Load instruction is a prvalue of type int, representing the integer value loaded from variable x.

predicate isGLValue()