Field

class Field (abstract, logical)

fields of composites - we do not treat them as objects in operands, we only deal with object + offset; we need this kind of node basically to reflect a field’s offset, which can not always be inferred simply from summing up the previous field’s offsets (alignment, vtable pointers) A Field cannot be referred to by a simple name, only by .name or ->name via Field_Selection.

Implemented interfaces:
Direct parents:
Ancestor classes and implemented interfaces:

Declarative_Node, General_Object_Interface, Logical_IR_Root, Member, Named_Entity, Object, Symbol, Typed_Object

Direct child classes:

Field

Kind

Type

Description

Offset

attribute

builtin Natural

Starting position of this field inside the parent composite. Equal to the value of offsetof(Parent, Field). The Offset does not include the Bit_Position for bit-fields.

Note: multiple fields can share the same offset in these circumstances:

  • In a union, all fields will have offset 0.

  • Neighboring bit-fields will have the same offset if they are stored together.

  • C++20 [[no_unique_address]]

Offset_In_Bits

attribute

builtin UInt64

Offset to the field in bits. This is equal to offsetof(Parent, Field) * CHAR_BIT. The Offset_In_Bits does not include the Bit_Position for bit-fields.

Parent (from Logical_IR_Root)

semantic

class Composite_Type

Its_Type (from Typed_Object)

semantic

class Type

the normalized, ‘underlying’ type

Object_Flags (from Typed_Object)

attribute

bitfield Object_Flags_Type

bits like “address taken” and “is pointer”

Physical (from Logical_IR_Root)

semantic to physical

class Physical_IR_Root

Visibility (from Member)

attribute

enum Visibility_Type

Name (from Named_Entity)

attribute

builtin String