1.1. Metadata Values (Enums)#

This document covers all used enums and flags within the Swift ABI.

1.1.1. Protocol Context#

class umbrella.swift.ProtocolClassConstraint[source]#

Flag that indicates whether an existential type is class-constrained or not.

Class = False#

The protocol is class-constrained, so only class types can conform to it.

This must be 0 for ABI compatibility with Objective-C protocol_t records.

Any = True#

Any type can conform to the protocol.

class umbrella.swift.SpecialProtocol[source]#
NotSpecial = 0#

Not a special protocol.

This must be 0 for ABI compatibility with Objective-C protocol_t records.

Error = 1#

The Error protocol.

final class umbrella.swift.ProtocolContextDescriptorFlags(_FlagSet__flags: int)[source]#

Flags for protocol context descriptors. These values are used as the kindSpecificFlags of the ContextDescriptorFlags for the protocol.

has_class_constraint() ProtocolClassConstraint[source]#

Whether this protocol is class-constrained.

is_resilient() bool[source]#

Whether this protocol is resilient.

get_special_protocol_kind() SpecialProtocol[source]#

Special protocol value.

class umbrella.swift.ProtocolRequirementKind[source]#
BaseProtocol = 0#
Method = 1#
Init = 2#
Getter = 3#
Setter = 4#
ReadCoroutine = 5#
ModifyCoroutine = 6#
AssociatedTypeAccessFunction = 7#
AssociatedConformanceAccessFunction = 8#
final class umbrella.swift.ProcolRequirementFlags(_ProcolRequirementFlags__flags: int)[source]#

Flags that go in a ProtocolRequirement structure.

kind: ProtocolRequirementKind#

The kind of the protocol requirement

instance: bool#

whether the requirement is bound to an instance

1.1.2. Metadata#

class umbrella.swift.MetadataKind[source]#

Kinds of Swift metadata records. Some of these are types, some aren’t. (not a complete view)

Class = 0#
Struct = 512#
Enum = 513#
class umbrella.swift.MetadataInitializationKind[source]#
NoMetadataInitialization = 0#

There are either no special rules for initializing the metadata or the metadata is generic. (Genericity is set in the non-kind-specific descriptor flags.)

SingletonMetadataInitialization = 1#

The type requires non-trivial singleton initialization using the “in-place” code pattern.

ForeignMetadataInitialization = 2#

The type requires non-trivial singleton initialization using the “foreign” code pattern.

1.1.3. Generic Context#

class umbrella.swift.GenericParamKind[source]#
Type = 0#

A type parameter.

TypePack = 1#

A type parameter pack.

Max = 63#
class umbrella.swift.GenericPackKind[source]#
Metadata = 0#
WitnessTable = 1#
class umbrella.swift.GenericRequirementKind[source]#
Protocol = 0#

A protocol requirement.

Sametype = 1#

A same-type requirement.

Baseclass = 2#

A base class requirement.

SameConformance = 3#

A “same-conformance” requirement, implied by a same-type or base-class constraint that binds a parameter with protocol requirements.

SameShape = 4#

A same-shape requirement between generic parameter packs.

Layout = 31#

A layout constraint.

final class umbrella.swift.GenericRequirementFlags(_GenericRequirementFlags__flags: int)[source]#
has_key_arg: bool#

whether this requirement is a key argument

kind: GenericRequirementKind#

the kind of this requirment

1.1.4. Context Descriptor#

class umbrella.swift.ClassFlags[source]#
IsSwiftPreStableABI = 1#

Is this a Swift class from the Darwin pre-stable ABI? This bit is clear in stable ABI Swift classes. The Objective-C runtime also reads this bit.

UsesSwiftRefcounting = 2#

Does this class use Swift refcounting?

HasCustomObjCName = 4#

Has this class a custom name, specified with the @objc attribute?

IsStaticSpecialization = 8#

Whether this metadata is a specialization of a generic metadata pattern which was created during compilation.

IsCanonicalStaticSpecialization = 16#

Whether this metadata is a specialization of a generic metadata pattern which was created during compilation and made to be canonical by modifying the metadata accessor.

final class umbrella.swift.ExtraClassDescriptorFlags(_FlagSet__flags: int)[source]#

Extra flags for resilient classes, since we need more than 16 bits of flags there.

has_obj_c_resilient_class_stub() bool[source]#
final class umbrella.swift.TypeContextDescriptorFlags(_TypeContextDescriptorFlags__flags: int)[source]#

Flags for nominal type context descriptors. These values are used as the kindSpecificFlags of the ContextDescriptorFlags for the type.

has_vtable: bool#

Set if the context descriptor includes metadata for dynamically constructing a class’s vtables at metadata instantiation time.

Only meaningful for class descriptors

has_override_table: bool#

Set if the context descriptor includes metadata for dynamically installing method overrides at metadata instantiation time.

has_resilient_super_class: bool#

Set if the context descriptor is for a class with resilient ancestry.

Only meaningful for class descriptors.

immediate_members_negativ: bool#

Whether the immediate class members in this metadata are allocated at negative offsets. For now, we don’t use this.

resilient_superclass_reference_kind: TypeReferenceKind#

The kind of reference that this class makes to its resilient superclass descriptor. A TypeReferenceKind.

Only meaningful for class descriptors.

has_import_info: bool#

Set if the type has extended import information.

If true, a sequence of strings follow the null terminator in the descriptor, terminated by an empty string (i.e. by two null terminators in a row). See TypeImportInfo for the details of these strings and the order in which they appear.

Meaningful for all type-descriptor kinds.

has_canonical_metadata_prespecializations: bool#

Set if the type descriptor has a pointer to a list of canonical prespecializations.

has_layout_string: bool#

Set if the metadata contains a pointer to a layout string

is_actor: bool#

Set if the class is an actor.

Only meaningful for class descriptors.

is_default_actor: bool#

Set if the class is a default actor class. Note that this is based on the best knowledge available to the class; actor classes with resilient superclassess might be default actors without knowing it.

Only meaningful for class descriptors.

meta_initialization: MetadataInitializationKind#

Whether there’s something unusual about how the metadata is initialized.

Meaningful for all type-descriptor kinds.

class umbrella.swift.ContextDescriptorKind[source]#
Module = 0#

This context descriptor represents a module.

Extension = 1#

This context descriptor represents an extension.

Anonymous = 2#

This context descriptor represents an anonymous possibly-generic context such as a function body.

Protocol = 3#

This context descriptor represents a protocol context.

Opaque = 4#

This context descriptor represents an opaque type alias.

Class = 16#

This context descriptor represents a class.

Struct = 17#

This context descriptor represents a struct.

Enum = 18#

This context descriptor represents an enum.

Type_Last = 31#

Last kind that represents a type of any sort.

final class umbrella.swift.AnonymousContextDescriptorFlags(_AnonymousContextDescriptorFlags__flags: int)[source]#
has_mangled_name: bool#

Whether this anonymous context descriptor is followed by its mangled name, which can be used to match the descriptor at runtime.

final class umbrella.swift.ContextDescriptorFlags(_ContextDescriptorFlags__flags: int)[source]#

1.1.5. Other Enums#

class umbrella.swift.TypeReferenceKind[source]#
DirectTypeDescriptor = 0#

The conformance is for a nominal type referenced directly; getTypeDescriptor() points to the type context descriptor.

IndirectTypeDescriptor = 1#

The conformance is for a nominal type referenced indirectly; getTypeDescriptor() points to the type context descriptor.

DirectObjCClassName = 2#

The conformance is for an Objective-C class that should be looked up by class name.

IndirectObjCClass = 3#

The conformance is for an Objective-C class that has no nominal type descriptor. getIndirectObjCClass() points to a variable that contains the pointer to the class object, which then requires a runtime call to get metadata.

On platforms without Objective-C interoperability, this case is unused.

class umbrella.swift.MethodDescriptorKind[source]#
Method = 0#
Init = 1#
Getter = 2#
Setter = 3#
ModifyCoroutine = 4#
ReadCoroutine = 5#
final class umbrella.swift.MethodDescriptorFlags(_MethodDescriptorFlags__flags: int)[source]#

Flags that go in a MethodDescriptor structure.

dynamic: bool#

Is the method marked ‘dynamic’?

instance: bool#

Is the method an instance member? Note that ‘init’ is not considered an instance member.

get_kind_name() str[source]#
class umbrella.swift.FieldDescriptorKind[source]#
Struct = 0#

Swift nominal types.

Class = 1#
Enum = 2#
MultiPayloadEnum = 3#

Fixed-size multi-payload enums have a special descriptor format that encodes spare bits.

Protocol = 4#

A Swift opaque protocol. There are no fields, just a record for the type itself.

ClassProtocol = 5#

A Swift class-bound protocol.

ObjCProtocol = 6#

An Objective-C protocol, which may be imported or defined in Swift.

ObjCClass = 7#

An Objective-C class, which may be imported or defined in Swift. In the former case, field type metadata is not emitted, and must be obtained from the Objective-C runtime.

final class umbrella.swift.FieldRecordFlags(_FieldRecordFlags__flags: int)[source]#
is_var: bool#

Is this a mutable var property?

is_indirect_case: bool#

Is this an indirect enum case?

is_artificial: bool#

Is this an artificial field?