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

Class GroupedMemoryLocation

A group of allocations represented as a single memory location.

If isAll() holds then this memory location represents all the enclosing allocations, and if isSome() holds then this memory location represents one or more of the enclosing allocations.

For example, consider the following snippet:

int* p;
int a, b;
if(b) {
  p = &a;
} else {
  p = &b;
}
*p = 42;

The write memory location associated with the write to *p writes to a grouped memory location representing the some allocation in the set {a, b}, and the subsequent Chi instruction merges the new value of {a, b} into a memory location that represents all of the allocations in the set.

Import path

import semmle.code.cpp.ir.implementation.aliased_ssa.internal.AliasedSSA

Direct supertypes

Indirect supertypes

Known direct subtypes

    Fields

    Predicates

    getAnAllocation

    Gets an allocation of this memory location.

    getGroup

    Gets the set of allocations associated with this memory location.

    getIRFunction
    getLocation
    getType
    getUniqueId
    getVirtualVariable
    isAll

    Holds if this memory location represents all the enclosing allocations.

    isMayAccess
    isSome

    Holds if this memory location represents one or more of the enclosing allocations.

    toStringInternal

    Inherited predicates

    canDefineReadOnly

    Holds if a definition of this location can be the definition of a read-only use location.

    from MemoryLocation0
    canReuseSsafrom MemoryLocation0
    getIRTypefrom MemoryLocation0
    isAlwaysAllocatedOnStack

    Holds if the location always represents memory allocated on the stack (for example, a variable with automatic storage duration).

    from MemoryLocation0
    isReadOnly

    Holds if the location cannot be overwritten except by definition of a MemoryLocation for which def.canDefineReadOnly() holds.

    from MemoryLocation0
    toStringfrom MemoryLocation0

    Charpred