swift

package
v1.1.193 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 7 Imported by: 0

README

swift

TODO

Sections
  • __swift5_entry
  • __swift5_builtin
  • __swift5_reflstr
  • __swift5_fieldmd
  • __swift5_assocty
  • __swift5_proto
  • __swift5_types
  • __swift5_types2 // the section containing additional type references
  • [?] __swift5_typeref
  • __swift5_protos
  • __swift5_capture
  • __swift5_replace
  • __swift5_replac2
  • __swift5_acfuncs
  • __swift5_mpenum ?? check Foundation
  • __constg_swiftt
  • __textg_swiftm
Protocol Conformances
  • parse witness tables (I got the patterns, but there's data after the description ptr (looks like func ptrs))
Type (Conformances)
  • add type's protocol conformances to their output (will require caching/looking up type names etc)
Protocols
  • properly represent signature requirements (I believe if they are key_args they belong in PROT<A: proto, A: proto> etc)
Metadata
  • parse all the different type's metatdata
Demangle (hard)
  • pure Go Swift demangler
  • symbolic mangled type algorithm + demangler

Documentation

Index

Constants

View Source
const (
	// Non-type metadata kinds have this bit set.
	MetadataKindIsNonType = 0x400
	// Non-heap metadata kinds have this bit set.
	MetadataKindIsNonHeap = 0x200
	// The above two flags are negative because the "class" kind has to be zero,
	// and class metadata is both type and heap metadata.
	// Runtime-private metadata has this bit set. The compiler must not statically
	// generate metadata objects with these kinds, and external tools should not
	// rely on the stability of these values or the precise binary layout of
	// their associated data structures.
	MetadataKindIsRuntimePrivate = 0x100
)
View Source
const (

	/// Does this pattern have an extra-data pattern?
	HasExtraDataPattern = 0

	/// Do instances of this pattern have a bitset of flags that occur at the
	/// end of the metadata, after the extra data if there is any?
	HasTrailingFlags = 1

	/// Does this pattern have an immediate-members pattern?
	Class_HasImmediateMembersPattern = 31

	/// For value metadata: the metadata kind of the type.
	Value_MetadataKind       = 21
	Value_MetadataKind_width = 11
)
View Source
const (
	/// Whether this protocol is class-constrained.
	HasClassConstraint       = 0
	HasClassConstraint_width = 1
	/// Whether this protocol is resilient.
	IsResilient = 1
	/// Special protocol value.
	SpecialProtocolKind       = 2
	SpecialProtocolKind_width = 6
)
View Source
const (
	// Bit used to indicate that an associated type witness is a pointer to a mangled name (vs. a pointer to metadata).
	AssociatedTypeMangledNameBit uint32 = 0x01
	// Prefix byte used to identify an associated type whose mangled name is relative to the protocol's context rather than the conforming type's context.
	AssociatedTypeInProtocolContextByte uint8 = 0xFF
)
View Source
const (
	/// The name of the standard library, which is a reserved module name.
	STDLIB_NAME = "Swift"
	/// The name of the Onone support library, which is a reserved module name.
	SWIFT_ONONE_SUPPORT = "SwiftOnoneSupport"
	/// The name of the SwiftShims module, which contains private stdlib decls.
	SWIFT_SHIMS_NAME = "SwiftShims"
	/// The name of the Builtin module, which contains Builtin functions.
	BUILTIN_NAME = "Builtin"
	/// The name of the clang imported header module.
	CLANG_HEADER_MODULE_NAME = "__ObjC"
	/// The prefix of module names used by LLDB to capture Swift expressions
	LLDB_EXPRESSIONS_MODULE_NAME_PREFIX = "__lldb_expr_"

	/// The name of the fake module used to hold imported Objective-C things.
	MANGLING_MODULE_OBJC = "__C"
	/// The name of the fake module used to hold synthesized ClangImporter things.
	MANGLING_MODULE_CLANG_IMPORTER = "__C_Synthesized"

	/// The name prefix for C++ template instantiation imported as a Swift struct.
	CXX_TEMPLATE_INST_PREFIX = "__CxxTemplateInst"

	SEMANTICS_PROGRAMTERMINATION_POINT = "programtermination_point"

	/// The name of the Builtin type prefix
	BUILTIN_TYPE_NAME_PREFIX = "Builtin."
)
View Source
const (
	/// The name of the Builtin type for Int
	BUILTIN_TYPE_NAME_INT = "Builtin.Int"
	/// The name of the Builtin type for Int8
	BUILTIN_TYPE_NAME_INT8 = "Builtin.Int8"
	/// The name of the Builtin type for Int16
	BUILTIN_TYPE_NAME_INT16 = "Builtin.Int16"
	/// The name of the Builtin type for Int32
	BUILTIN_TYPE_NAME_INT32 = "Builtin.Int32"
	/// The name of the Builtin type for Int64
	BUILTIN_TYPE_NAME_INT64 = "Builtin.Int64"
	/// The name of the Builtin type for Int128
	BUILTIN_TYPE_NAME_INT128 = "Builtin.Int128"
	/// The name of the Builtin type for Int256
	BUILTIN_TYPE_NAME_INT256 = "Builtin.Int256"
	/// The name of the Builtin type for Int512
	BUILTIN_TYPE_NAME_INT512 = "Builtin.Int512"
	/// The name of the Builtin type for IntLiteral
	BUILTIN_TYPE_NAME_INTLITERAL = "Builtin.IntLiteral"
	/// The name of the Builtin type for IEEE Floating point types.
	BUILTIN_TYPE_NAME_FLOAT = "Builtin.FPIEEE"
	// The name of the builtin type for power pc specific floating point types.
	BUILTIN_TYPE_NAME_FLOAT_PPC = "Builtin.FPPPC"
	/// The name of the Builtin type for NativeObject
	BUILTIN_TYPE_NAME_NATIVEOBJECT = "Builtin.NativeObject"
	/// The name of the Builtin type for BridgeObject
	BUILTIN_TYPE_NAME_BRIDGEOBJECT = "Builtin.BridgeObject"
	/// The name of the Builtin type for RawPointer
	BUILTIN_TYPE_NAME_RAWPOINTER = "Builtin.RawPointer"
	/// The name of the Builtin type for UnsafeValueBuffer
	BUILTIN_TYPE_NAME_UNSAFEVALUEBUFFER = "Builtin.UnsafeValueBuffer"
	/// The name of the Builtin type for UnknownObject
	///
	/// This no longer exists as an AST-accessible type, but it's still used for
	/// fields shaped like AnyObject when ObjC interop is enabled.
	BUILTIN_TYPE_NAME_UNKNOWNOBJECT = "Builtin.UnknownObject"
	/// The name of the Builtin type for Vector
	BUILTIN_TYPE_NAME_VEC = "Builtin.Vec"
	/// The name of the Builtin type for SILToken
	BUILTIN_TYPE_NAME_SILTOKEN = "Builtin.SILToken"
	/// The name of the Builtin type for Word
	BUILTIN_TYPE_NAME_WORD = "Builtin.Word"
)
View Source
const (
	KindMask                = 0x0F // 16 kinds should be enough for anybody
	IsInstanceMask          = 0x10
	IsDynamicMask           = 0x20
	IsAsyncMask             = 0x40
	ExtraDiscriminatorShift = 16
	ExtraDiscriminatorMask  = 0xFFFF0000
)
View Source
const (

	/// Whether there's something unusual about how the metadata is
	/// initialized.
	///
	/// Meaningful for all type-descriptor kinds.
	MetadataInitialization       = 0
	MetadataInitialization_width = 2

	/// 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.
	HasImportInfo = 2

	/// Set if the type descriptor has a pointer to a list of canonical
	/// prespecializations.
	HasCanonicalMetadataPrespecializations = 3

	/// Set if the metadata contains a pointer to a layout string
	HasLayoutString = 4

	/// Set if the class is an actor.
	///
	/// Only meaningful for class descriptors.
	Class_IsActor = 7

	/// 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.
	Class_IsDefaultActor = 8

	/// The kind of reference that this class makes to its resilient superclass
	/// descriptor.  A TypeReferenceKind.
	///
	/// Only meaningful for class descriptors.
	Class_ResilientSuperclassReferenceKind       = 9
	Class_ResilientSuperclassReferenceKind_width = 3

	/// Whether the immediate class members in this metadata are allocated
	/// at negative offsets.  For now, we don't use this.
	Class_AreImmediateMembersNegative = 12

	/// Set if the context descriptor is for a class with resilient ancestry.
	///
	/// Only meaningful for class descriptors.
	Class_HasResilientSuperclass = 13

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

	/// Set if the context descriptor includes metadata for dynamically
	/// constructing a class's vtables at metadata instantiation time.
	///
	/// Only meaningful for class descriptors.
	Class_HasVTable = 15
)
View Source
const (
	SpecialKindMask            = 0x000000FF
	SpecialKindShift           = 0
	HasGeneralizationSignature = 0x00000100
	HasTypeExpression          = 0x00000200
	HasSuggestedValueWitnesses = 0x00000400
	HasImplicitReqSigParams    = 0x00000800
	HasImplicitGenSigParams    = 0x00001000
	HasTypePacks               = 0x00002000
)
View Source
const EnableChainingMask = 0x1
View Source
const (
	// Whether this anonymous context descriptor is followed by its
	// mangled name, which can be used to match the descriptor at runtime.
	HasMangledName = 0
)
View Source
const (
	// Set if the context descriptor includes a pointer to an Objective-C
	// resilient class stub structure. See the description of
	// TargetObjCResilientClassStubInfo in Metadata.h for details.
	//
	// Only meaningful for class descriptors when Objective-C interop is
	// enabled.
	HasObjCResilientClassStub = 0
)
View Source
const MaxNumExtraInhabitants = 0x7FFFFFFF
View Source
const SWIFT_REFLECTION_METADATA_VERSION = 3 // superclass field

Variables

View Source
var MangledKnownTypeKind = map[string]string{
	"A": "Swift.AutoreleasingUnsafeMutablePointer",
	"a": "Swift.Array",
	"B": "Swift.BinaryFloatingPoint",
	"b": "Swift.Bool",
	"c": "MangledKnownTypeKind2",
	"D": "Swift.Dictionary",
	"d": "Swift.Float64",
	"E": "Swift.Encodable",
	"e": "Swift.Decodable",
	"F": "Swift.FloatingPoint",
	"f": "Swift.Float32",
	"G": "Swift.RandomNumberGenerator",
	"H": "Swift.Hashable",
	"h": "Swift.Set",
	"I": "Swift.DefaultIndices",
	"i": "Swift.Int",
	"J": "Swift.Character",
	"j": "Swift.Numeric",
	"K": "Swift.BidirectionalCollection",
	"k": "Swift.RandomAccessCollection",
	"L": "Swift.Comparable",
	"l": "Swift.Collection",
	"M": "Swift.MutableCollection",
	"m": "Swift.RangeReplaceableCollection",
	"N": "Swift.ClosedRange",
	"n": "Swift.Range",
	"O": "Swift.ObjectIdentifier",
	"P": "Swift.UnsafePointer",
	"p": "Swift.UnsafeMutablePointer",
	"Q": "Swift.Equatable",
	"q": "Swift.Optional",
	"R": "Swift.UnsafeBufferPointer",
	"r": "Swift.UnsafeMutableBufferPointer",
	"S": "Swift.String",
	"s": "Swift.Substring",
	"T": "Swift.Sequence",
	"t": "Swift.IteratorProtocol",
	"U": "Swift.UnsignedInteger",
	"u": "Swift.UInt",
	"V": "Swift.UnsafeRawPointer",
	"v": "Swift.UnsafeMutableRawPointer",
	"W": "Swift.UnsafeRawBufferPointer",
	"w": "Swift.UnsafeMutableRawBufferPointer",
	"X": "Swift.RangeExpression",
	"x": "Swift.Strideable",
	"Y": "Swift.RawRepresentable",
	"y": "Swift.StringProtocol",
	"Z": "Swift.SignedInteger",
	"z": "Swift.BinaryInteger",
}
View Source
var MangledKnownTypeKind2 = map[string]string{
	"A": "Swift.Actor",
	"C": "Swift.CheckedContinuation",
	"c": "Swift.UnsafeContinuation",
	"E": "Swift.CancellationError",
	"e": "Swift.UnownedSerialExecutor",
	"F": "Swift.Executor",
	"f": "Swift.SerialExecutor",
	"G": "Swift.TaskGroup",
	"g": "Swift.ThrowingTaskGroup",
	"I": "Swift.AsyncIteratorProtocol",
	"i": "Swift.AsyncSequence",
	"J": "Swift.UnownedJob",
	"M": "Swift.MainActor",
	"P": "Swift.TaskPriority",
	"S": "Swift.AsyncStream",
	"s": "Swift.AsyncThrowingStream",
	"T": "Swift.Task",
	"t": "Swift.UnsafeCurrentTask",
}
View Source
var MangledType = map[string]string{
	"Bb":        "Builtin.BridgeObject",
	"BB":        "Builtin.UnsafeValueBuffer",
	"Bc":        "Builtin.RawUnsafeContinuation",
	"BD":        "Builtin.DefaultActorStorage",
	"Be":        "Builtin.Executor",
	"Bd":        "Builtin.NonDefaultDistributedActorStorage",
	"Bf":        "Builtin.Float<n>",
	"Bi":        "Builtin.Int<n>",
	"BI":        "Builtin.IntLiteral",
	"Bj":        "Builtin.Job",
	"BP":        "Builtin.PackIndex",
	"BO":        "Builtin.UnknownObject",
	"Bo":        "Builtin.NativeObject",
	"Bp":        "Builtin.RawPointer",
	"Bt":        "Builtin.SILToken",
	"Bv":        "Builtin.Vec<n>x<type>",
	"Bw":        "Builtin.Word",
	"c":         "function type (escaping)",
	"X":         "special function type",
	"Sg":        "?",
	"ySqG":      "?",
	"GSg":       "?",
	"_pSg":      "?",
	"SgSg":      "??",
	"ypG":       "Any",
	"p":         "Any",
	"SSG":       "String",
	"SSGSg":     "String?",
	"SSSgG":     "String?",
	"SpySvSgGG": "UnsafeMutablePointer<UNumberFormat?>",
	"SiGSg":     "Int?",
	"Xo":        "@unowned type",
	"Xu":        "@unowned(unsafe) type",
	"Xw":        "@weak type",
	"XF":        "function implementation type (currently unused)",
	"Xb":        "SIL @box type (deprecated)",
	"Xx":        "SIL box type",
	"XD":        "dynamic self type",
	"m":         "metatype without representation",
	"XM":        "metatype with representation",
	"Xp":        "existential metatype without representation",
	"Xm":        "existential metatype with representation",
	"Xe":        "(error)",
	"x":         "A",
	"q_":        "B",
	"yxq_G":     "<A, B>",
	"xq_":       "<A, B>",
	"Sb":        "Swift.Bool",
	"Qz":        "==",
	"Qy_":       "==",
	"Qy0_":      "==",
	"SgXw":      "?",
}

MangledType is a mangled type map

Functions

This section is empty.

Types

type ATRecordType

type ATRecordType struct {
	AssociatedTypeRecord
	Name                string
	SubstitutedTypeName string
}

type AccessibleFunctionCacheEntry

type AccessibleFunctionCacheEntry struct {
	Name    string
	NameLen uint32
	R       uint64 // AccessibleFunctionRecord

}

type AccessibleFunctionFlags

type AccessibleFunctionFlags uint32
const (
	Distributed AccessibleFunctionFlags = 0
)

type AccessibleFunctionsSection

type AccessibleFunctionsSection struct {
	Begin uint64 // AccessibleFunctionRecord
	End   uint64 // AccessibleFunctionRecord
}

type AccessibleFunctionsState

type AccessibleFunctionsState struct {
	Cache          AccessibleFunctionCacheEntry
	SectionsToScan AccessibleFunctionsSection
}

type Anonymous

type Anonymous struct {
	TargetAnonymousContextDescriptor
	GenericContext     *GenericContext
	MangledContextName string
}

type AnonymousContextDescriptorFlags

type AnonymousContextDescriptorFlags uint16

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

func (AnonymousContextDescriptorFlags) HasMangledName

func (f AnonymousContextDescriptorFlags) HasMangledName() bool

type AssociatedType

type AssociatedType struct {
	AssociatedTypeDescriptor
	Address            uint64
	ConformingTypeAddr uint64
	ConformingTypeName string
	ProtocolTypeName   string
	TypeRecords        []ATRecordType
}

func (AssociatedType) String

func (a AssociatedType) String() string

func (AssociatedType) Verbose

func (a AssociatedType) Verbose() string

type AssociatedTypeDescriptor

type AssociatedTypeDescriptor struct {
	ConformingTypeNameOffset RelativeDirectPointer
	ProtocolTypeNameOffset   RelativeDirectPointer
	NumAssociatedTypes       uint32
	AssociatedTypeRecordSize uint32
}

AssociatedTypeDescriptor an associated type descriptor contains a collection of associated type records for a conformance. ref: include/swift/RemoteInspection/Records.h

func (*AssociatedTypeDescriptor) Read

func (a *AssociatedTypeDescriptor) Read(r io.Reader, addr uint64) error

func (AssociatedTypeDescriptor) Size

type AssociatedTypeRecord

type AssociatedTypeRecord struct {
	NameOffset                RelativeDirectPointer
	SubstitutedTypeNameOffset RelativeDirectPointer
}

AssociatedTypeRecord type records describe the mapping from an associated type to the type witness of a conformance. ref: include/swift/RemoteInspection/Records.h

func (*AssociatedTypeRecord) Read

func (a *AssociatedTypeRecord) Read(r io.Reader, addr uint64) error

func (AssociatedTypeRecord) Size

func (a AssociatedTypeRecord) Size() int64

type AutomaticDynamicReplacementEntry

type AutomaticDynamicReplacementEntry struct {
	ReplacementScope int32 // DynamicReplacementScope
	Flags            uint32
}

type AutomaticDynamicReplacements

type AutomaticDynamicReplacements struct {
	Flags     uint32
	NumScopes uint32
	AutomaticDynamicReplacementEntry
}

type AutomaticDynamicReplacementsSome

type AutomaticDynamicReplacementsSome struct {
	Flags           uint32
	NumReplacements uint32
	Replacements    []DynamicReplacementSomeDescriptor
}

type BuiltinType

type BuiltinType struct {
	BuiltinTypeDescriptor
	Name string
}

BuiltinType builtin swift type

func (BuiltinType) String

func (b BuiltinType) String() string

func (BuiltinType) Verbose

func (b BuiltinType) Verbose() string

type BuiltinTypeDescriptor

type BuiltinTypeDescriptor struct {
	TypeName            RelativeDirectPointer
	Size                uint32
	AlignmentAndFlags   builtinTypeFlag
	Stride              uint32
	NumExtraInhabitants uint32
}

BuiltinTypeDescriptor type records describe basic layout information about any builtin types referenced from the other sections. ref: include/swift/RemoteInspection/Records.h

func (*BuiltinTypeDescriptor) Read

func (b *BuiltinTypeDescriptor) Read(r io.Reader, addr uint64) error

type Capture

type Capture struct {
	CaptureDescriptor
	Address         uint64
	CaptureTypes    []CaptureType
	MetadataSources []MetadataSource
	Bindings        []NecessaryBindings
}

func (Capture) String

func (c Capture) String() string

type CaptureDescriptor

type CaptureDescriptor struct {
	NumCaptureTypes    uint32 // The number of captures in the closure and the number of typerefs that immediately follow this struct.
	NumMetadataSources uint32 // The number of sources of metadata available in the MetadataSourceMap directly following the list of capture's typerefs.
	NumBindings        uint32 // The number of items in the NecessaryBindings structure at the head of the closure.
}

CaptureDescriptor describe the layout of a closure context object. Unlike nominal types, the generic substitutions for a closure context come from the object, and not the metadata. ref: include/swift/RemoteInspection/Records.h - CaptureDescriptor

type CaptureType

type CaptureType struct {
	CaptureTypeRecord
	TypeName string
}

type CaptureTypeRecord

type CaptureTypeRecord struct {
	MangledTypeName RelativeDirectPointer
}

func (*CaptureTypeRecord) Read

func (ctr *CaptureTypeRecord) Read(r io.Reader, addr uint64) error

func (CaptureTypeRecord) Size

func (ctr CaptureTypeRecord) Size() int64

type Class

type Class struct {
	TargetClassDescriptor
	SuperClass                 string
	GenericContext             *TypeGenericContext
	ForeignMetadata            *TargetForeignMetadataInitialization
	SingletonMetadata          *TargetSingletonMetadataInitialization
	VTable                     *VTable
	ResilientSuperclass        *ResilientSuperclass
	MethodOverrides            []TargetMethodOverrideDescriptor
	ObjCResilientClassStubInfo *TargetObjCResilientClassStubInfo
	Metadatas                  []Metadata
	MetadataAccessors          []TargetCanonicalSpecializedMetadataAccessorsListEntry
	CachingOnceToken           *TargetCanonicalSpecializedMetadatasCachingOnceToken
}

type ClassFlags

type ClassFlags uint32
const (
	/// 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.
	IsSwiftPreStableABI ClassFlags = 0x1
	/// Does this class use Swift refcounting?
	UsesSwiftRefcounting ClassFlags = 0x2
	/// Has this class a custom name, specified with the @objc attribute?
	HasCustomObjCName ClassFlags = 0x4
	/// Whether this metadata is a specialization of a generic metadata pattern
	/// which was created during compilation.
	IsStaticSpecialization ClassFlags = 0x8
	/// 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.
	IsCanonicalStaticSpecialization ClassFlags = 0x10
)

type ConformanceDescriptor

type ConformanceDescriptor struct {
	TargetProtocolConformanceDescriptor
	Address                 uint64
	Protocol                string
	TypeRef                 *Type
	Retroactive             *RelativeString // context of a retroactive conformance
	ConditionalRequirements []TargetGenericRequirement
	ConditionalPackShapes   []GenericPackShapeDescriptor
	ResilientWitnesses      []ResilientWitnesses
	GenericWitnessTable     *TargetGenericWitnessTable
	WitnessTablePattern     *PCDWitnessTable
}

func (ConformanceDescriptor) String

func (c ConformanceDescriptor) String() string

func (ConformanceDescriptor) Verbose

func (c ConformanceDescriptor) Verbose() string

type ConformanceFlags

type ConformanceFlags uint32
const (
	UnusedLowBits ConformanceFlags = 0x07 // historical conformance kind

	TypeMetadataKindMask  ConformanceFlags = 0x7 << 3 // 8 type reference kinds
	TypeMetadataKindShift                  = 3

	IsRetroactiveMask          ConformanceFlags = 0x01 << 6
	IsSynthesizedNonUniqueMask ConformanceFlags = 0x01 << 7

	NumConditionalRequirementsMask  ConformanceFlags = 0xFF << 8
	NumConditionalRequirementsShift                  = 8

	HasResilientWitnessesMask  ConformanceFlags = 0x01 << 16
	HasGenericWitnessTableMask ConformanceFlags = 0x01 << 17

	NumConditionalPackDescriptorsMask  ConformanceFlags = 0xFF << 24
	NumConditionalPackDescriptorsShift                  = 24
)

func (ConformanceFlags) GetNumConditionalRequirements

func (f ConformanceFlags) GetNumConditionalRequirements() int

GetNumConditionalRequirements retrieve the # of conditional requirements.

func (ConformanceFlags) GetTypeReferenceKind

func (f ConformanceFlags) GetTypeReferenceKind() TypeReferenceKind

GetTypeReferenceKind retrieve the type reference kind kind.

func (ConformanceFlags) HasGenericWitnessTable

func (f ConformanceFlags) HasGenericWitnessTable() bool

HasGenericWitnessTable whether this conformance has a generic witness table that may need to be instantiated.

func (ConformanceFlags) HasResilientWitnesses

func (f ConformanceFlags) HasResilientWitnesses() bool

HasResilientWitnesses whether this conformance has any resilient witnesses.

func (ConformanceFlags) IsRetroactive

func (f ConformanceFlags) IsRetroactive() bool

IsRetroactive Is the conformance "retroactive"?

A conformance is retroactive when it occurs in a module that is neither the module in which the protocol is defined nor the module in which the conforming type is defined. With retroactive conformance, it is possible to detect a conflict at run time.

func (ConformanceFlags) IsSynthesizedNonUnique

func (f ConformanceFlags) IsSynthesizedNonUnique() bool

IsSynthesizedNonUnique is the conformance synthesized in a non-unique manner?

The Swift compiler will synthesize conformances on behalf of some imported entities (e.g., C typedefs with the swift_wrapper attribute). Such conformances are retroactive by nature, but the presence of multiple such conformances is not a conflict because all synthesized conformances will be equivalent.

func (ConformanceFlags) NumConditionalPackShapeDescriptors

func (f ConformanceFlags) NumConditionalPackShapeDescriptors() int

NumConditionalPackShapeDescriptors retrieve the # of conditional pack shape descriptors.

func (ConformanceFlags) String

func (f ConformanceFlags) String() string

type ContextDescriptorFlags

type ContextDescriptorFlags uint32

func (ContextDescriptorFlags) IsGeneric

func (f ContextDescriptorFlags) IsGeneric() bool

func (ContextDescriptorFlags) IsUnique

func (f ContextDescriptorFlags) IsUnique() bool

func (ContextDescriptorFlags) Kind

func (ContextDescriptorFlags) KindSpecific

func (ContextDescriptorFlags) String

func (f ContextDescriptorFlags) String() string

func (ContextDescriptorFlags) Version

func (f ContextDescriptorFlags) Version() uint8

type ContextDescriptorKind

type ContextDescriptorKind uint8
const (
	// This context descriptor represents a module.
	CDKindModule ContextDescriptorKind = 0 // module

	/// This context descriptor represents an extension.
	CDKindExtension ContextDescriptorKind = 1 // extension

	/// This context descriptor represents an anonymous possibly-generic context
	/// such as a function body.
	CDKindAnonymous ContextDescriptorKind = 2 // anonymous

	/// This context descriptor represents a protocol context.
	CDKindProtocol ContextDescriptorKind = 3 // protocol

	/// This context descriptor represents an opaque type alias.
	CDKindOpaqueType ContextDescriptorKind = 4 // opaque_type

	/// First kind that represents a type of any sort.
	CDKindTypeFirst = 16 // type_first

	/// This context descriptor represents a class.
	CDKindClass ContextDescriptorKind = CDKindTypeFirst // class

	/// This context descriptor represents a struct.
	CDKindStruct ContextDescriptorKind = CDKindTypeFirst + 1 // struct

	/// This context descriptor represents an enum.
	CDKindEnum ContextDescriptorKind = CDKindTypeFirst + 2 // enum

	/// Last kind that represents a type of any sort.
	CDKindTypeLast = 31 // type_last
)

func (ContextDescriptorKind) String

func (i ContextDescriptorKind) String() string

type DynamicReplacementChainEntry

type DynamicReplacementChainEntry struct {
	ImplementationFunction uint64 // void *
	Next                   uint64 // DynamicReplacementChainEntry *
}

type DynamicReplacementDescriptor

type DynamicReplacementDescriptor struct {
	ReplacedFunctionKey int32 // DynamicReplacementKey
	ReplacementFunction int32 // UNION w/ ReplacementAsyncFunction - TargetCompactFunctionPointer|TargetRelativeDirectPointer
	ChainEntry          int32 // DynamicReplacementChainEntry
	Flags               uint32
}

func (DynamicReplacementDescriptor) ShouldChain

func (d DynamicReplacementDescriptor) ShouldChain() bool

type DynamicReplacementKey

type DynamicReplacementKey struct {
	Root  int32
	Flags uint32
}

func (DynamicReplacementKey) ExtraDiscriminator

func (d DynamicReplacementKey) ExtraDiscriminator() uint16

func (DynamicReplacementKey) IsAsync

func (d DynamicReplacementKey) IsAsync() bool

type DynamicReplacementScope

type DynamicReplacementScope struct {
	Flags           uint32
	NumReplacements uint32 // hard coded to 1
	DynamicReplacementDescriptor
}

type DynamicReplacementSomeDescriptor

type DynamicReplacementSomeDescriptor struct {
	OriginalOpaqueTypeDesc    int32 // OpaqueTypeDescriptor -> TargetContextDescriptor
	ReplacementOpaqueTypeDesc int32 // OpaqueTypeDescriptor -> TargetContextDescriptor
}

type Enum

type ExtendedExistentialTypeShapeFlags

type ExtendedExistentialTypeShapeFlags uint32

func (ExtendedExistentialTypeShapeFlags) GetSpecialKind

func (ExtendedExistentialTypeShapeFlags) HasGeneralizationSignature

func (f ExtendedExistentialTypeShapeFlags) HasGeneralizationSignature() bool

func (ExtendedExistentialTypeShapeFlags) HasImplicitGenSigParams

func (f ExtendedExistentialTypeShapeFlags) HasImplicitGenSigParams() bool

The parameters of the generalization signature are not stored explicitly in the shape.

In order to enable this, there must be no more than MaxNumImplicitGenericParamDescriptors generic parameters, and they must match GenericParamDescriptor::implicit().

func (ExtendedExistentialTypeShapeFlags) HasImplicitReqSigParams

func (f ExtendedExistentialTypeShapeFlags) HasImplicitReqSigParams() bool

The parameters of the requirement signature are not stored explicitly in the shape.

In order to enable this, there must be no more than MaxNumImplicitGenericParamDescriptors generic parameters, and they must match GenericParamDescriptor::implicit().

func (ExtendedExistentialTypeShapeFlags) HasSuggestedValueWitnesses

func (f ExtendedExistentialTypeShapeFlags) HasSuggestedValueWitnesses() bool

func (ExtendedExistentialTypeShapeFlags) HasTypeExpression

func (f ExtendedExistentialTypeShapeFlags) HasTypeExpression() bool

func (ExtendedExistentialTypeShapeFlags) HasTypePacks

func (f ExtendedExistentialTypeShapeFlags) HasTypePacks() bool

Whether the generic context has type parameter packs. This occurs when the existential has a superclass requirement whose class declaration has a type parameter pack, eg `any P & C<...>` with `class C<each T> {}`.

func (ExtendedExistentialTypeShapeFlags) IsClassConstrained

func (f ExtendedExistentialTypeShapeFlags) IsClassConstrained() bool

func (ExtendedExistentialTypeShapeFlags) IsMetatypeConstrained

func (f ExtendedExistentialTypeShapeFlags) IsMetatypeConstrained() bool

func (ExtendedExistentialTypeShapeFlags) IsOpaque

func (ExtendedExistentialTypeShapeFlags) String

type Extension

type Extension struct {
	TargetExtensionContextDescriptor
	GenericContext *GenericContext
}

type ExtraClassDescriptorFlags

type ExtraClassDescriptorFlags uint32

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

func (ExtraClassDescriptorFlags) HasObjCResilientClassStub

func (f ExtraClassDescriptorFlags) HasObjCResilientClassStub() bool

type Field

type Field struct {
	FieldDescriptor
	Address    uint64
	Type       string
	SuperClass string
	Records    []FieldRecord
}

func (Field) IsClass

func (f Field) IsClass() bool

func (Field) IsEnum

func (f Field) IsEnum() bool

func (Field) IsProtocol

func (f Field) IsProtocol() bool

func (Field) IsStruct

func (f Field) IsStruct() bool

func (Field) String

func (f Field) String() string

func (Field) Verbose

func (f Field) Verbose() string

type FieldDescriptor

type FieldDescriptor struct {
	MangledTypeNameOffset RelativeDirectPointer
	SuperclassOffset      RelativeDirectPointer
	Kind                  FieldDescriptorKind
	FieldRecordSize       uint16
	NumFields             uint32
}

FieldDescriptor contain a collection of field records for a single class, struct or enum declaration. ref: swift/include/swift/Reflection/Records.h

func (*FieldDescriptor) Read

func (fd *FieldDescriptor) Read(r io.Reader, addr uint64) error

func (FieldDescriptor) Size

func (fd FieldDescriptor) Size() uint64

type FieldDescriptorKind

type FieldDescriptorKind uint16
const (
	// Swift nominal types.
	FDKindStruct FieldDescriptorKind = iota // struct
	FDKindClass                             // class
	FDKindEnum                              // enum

	// Fixed-size multi-payload enums have a special descriptor format that
	// encodes spare bits.
	//
	// FIXME: Actually implement this. For now, a descriptor with this kind
	// just means we also have a builtin descriptor from which we get the
	// size and alignment.
	FDKindMultiPayloadEnum // multi-payload enum

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

	// A Swift class-bound protocol.
	FDKindClassProtocol // class protocol

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

	// 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.
	FDKindObjCClass // objc class
)

func (FieldDescriptorKind) String

func (i FieldDescriptorKind) String() string

type FieldRecord

type FieldRecord struct {
	FieldRecordDescriptor
	Name        string
	MangledType string
}

type FieldRecordDescriptor

type FieldRecordDescriptor struct {
	Flags                 FieldRecordFlags
	MangledTypeNameOffset RelativeDirectPointer
	FieldNameOffset       RelativeDirectPointer
}

func (*FieldRecordDescriptor) Read

func (frd *FieldRecordDescriptor) Read(r io.Reader, addr uint64) error

func (FieldRecordDescriptor) Size

func (fd FieldRecordDescriptor) Size() uint64

type FieldRecordFlags

type FieldRecordFlags uint32
const (
	// IsIndirectCase is this an indirect enum case?
	IsIndirectCase FieldRecordFlags = 0x1
	// IsVar is this a mutable `var` property?
	IsVar FieldRecordFlags = 0x2
	// IsArtificial is this an artificial field?
	IsArtificial FieldRecordFlags = 0x4
)

func (FieldRecordFlags) IsArtificial

func (f FieldRecordFlags) IsArtificial() bool

func (FieldRecordFlags) IsIndirectCase

func (f FieldRecordFlags) IsIndirectCase() bool

func (FieldRecordFlags) IsVar

func (f FieldRecordFlags) IsVar() bool

func (FieldRecordFlags) String

func (f FieldRecordFlags) String() string

type GenericContextDescriptorFlags

type GenericContextDescriptorFlags uint16

func (GenericContextDescriptorFlags) HasTypePacks

func (f GenericContextDescriptorFlags) HasTypePacks() bool

HasTypePacks is whether this generic context has at least one type parameter pack, in which case the generic context will have a trailing GenericPackShapeHeader.

type GenericEnvironmentFlags

type GenericEnvironmentFlags uint32

func (GenericEnvironmentFlags) GetNumGenericParameterLevels

func (f GenericEnvironmentFlags) GetNumGenericParameterLevels() uint32

func (GenericEnvironmentFlags) GetNumGenericRequirements

func (f GenericEnvironmentFlags) GetNumGenericRequirements() uint32

type GenericMetadataPattern

type GenericMetadataPattern struct {
	TargetGenericMetadataPattern
	ValueWitnessTable *ValueWitnessTable
	ExtraDataPattern  *TargetGenericMetadataPartialPattern
}

type GenericMetadataPatternFlags

type GenericMetadataPatternFlags uint32

func (GenericMetadataPatternFlags) HasClassImmediateMembersPattern

func (f GenericMetadataPatternFlags) HasClassImmediateMembersPattern() bool

func (GenericMetadataPatternFlags) HasExtraDataPattern

func (f GenericMetadataPatternFlags) HasExtraDataPattern() bool

func (GenericMetadataPatternFlags) HasTrailingFlags

func (f GenericMetadataPatternFlags) HasTrailingFlags() bool

func (GenericMetadataPatternFlags) MetadataKind

func (f GenericMetadataPatternFlags) MetadataKind() MetadataKind

func (GenericMetadataPatternFlags) String

type GenericPackKind

type GenericPackKind uint16
const (
	GPKMetadata     GenericPackKind = 0 // metadata
	GPKWitnessTable GenericPackKind = 1 // witness-table
)

func (GenericPackKind) String

func (i GenericPackKind) String() string

type GenericPackShapeDescriptor

type GenericPackShapeDescriptor struct {
	Kind       GenericPackKind
	Index      uint16 // The index of this metadata pack or witness table pack in the generic arguments array.
	ShapeClass uint16 // The equivalence class of this pack under the same-shape relation.
	// contains filtered or unexported fields
}

GenericPackShapeDescriptor the GenericPackShapeHeader is followed by an array of these descriptors, whose length is given by the header's NumPacks field.

The invariant is that all pack descriptors with GenericPackKind::Metadata must precede those with GenericPackKind::WitnessTable, and for each kind, the pack descriptors are ordered by their Index.

This allows us to iterate over the generic arguments array in parallel with the array of pack shape descriptors. We know we have a metadata or witness table when we reach the generic argument whose index is stored in the next descriptor; we increment the descriptor pointer in this case.

ref: swift/ABI/GenericContext.h - GenericPackShapeDescriptor

type GenericPackShapeHeader

type GenericPackShapeHeader struct {
	NumPacks        uint16 // The number of generic parameters and conformance requirements which are packs.
	NumShapeClasses uint16 // The number of equivalence classes in the same-shape relation.
}

GenericPackShapeHeader object ref: swift/ABI/GenericContext.h - GenericPackShapeHeader

type GenericParamDescriptor

type GenericParamDescriptor uint8

Don't set 0x40 for compatibility with pre-Swift 5.8 runtimes (4 byte align)

func (GenericParamDescriptor) GetKind

func (GenericParamDescriptor) HasKeyArgument

func (g GenericParamDescriptor) HasKeyArgument() bool

func (GenericParamDescriptor) String

func (g GenericParamDescriptor) String() string

type GenericParamKind

type GenericParamKind uint8
const (
	// A type parameter.
	GPKType GenericParamKind = 0 // type
	// A type parameter pack.
	GPKTypePack GenericParamKind = 1    // type_pack
	GPKMax      GenericParamKind = 0x3F // max
)

func (GenericParamKind) String

func (i GenericParamKind) String() string

type GenericRequirementFlags

type GenericRequirementFlags uint32

func (GenericRequirementFlags) HasExtraArgument

func (f GenericRequirementFlags) HasExtraArgument() bool

func (GenericRequirementFlags) HasKeyArgument

func (f GenericRequirementFlags) HasKeyArgument() bool

func (GenericRequirementFlags) Kind

func (GenericRequirementFlags) String

func (f GenericRequirementFlags) String() string

type GenericRequirementKind

type GenericRequirementKind uint8
const (
	// A protocol requirement.
	GRKindProtocol GenericRequirementKind = 0 // protocol
	// A same-type requirement.
	GRKindSameType GenericRequirementKind = 1 // same-type
	// A base class requirement.
	GRKindBaseClass GenericRequirementKind = 2 // base-class
	// A "same-conformance" requirement, implied by a same-type or base-class constraint that binds a parameter with protocol requirements.
	GRKindSameConformance GenericRequirementKind = 3 // same-conformance
	// A same-shape requirement between generic parameter packs.
	GRKSameShape GenericRequirementKind = 4 // same-shape
	// A layout requirement.
	GRKindLayout GenericRequirementKind = 0x1F // layout
)

func (GenericRequirementKind) String

func (i GenericRequirementKind) String() string

type GenericRequirementLayoutKind

type GenericRequirementLayoutKind uint32
const (
	// A class constraint.
	GRLKClass GenericRequirementLayoutKind = 0 // class
)

func (GenericRequirementLayoutKind) String

type MDKind

type MDKind uint8
const (
	MDKMethod MDKind = iota
	MDKInit
	MDKGetter
	MDKSetter
	MDKModifyCoroutine
	MDKReadCoroutine
	MDKMax
)

func (MDKind) String

func (md MDKind) String() string

type MetadataInitializationKind

type MetadataInitializationKind uint8
const (
	// 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.)
	MetadataInitNone MetadataInitializationKind = 0 // none
	//The type requires non-trivial singleton initialization using the "in-place" code pattern.
	MetadataInitSingleton MetadataInitializationKind = 1 // singleton
	// The type requires non-trivial singleton initialization using the "foreign" code pattern.
	MetadataInitForeign MetadataInitializationKind = 2 // foreign

)

func (MetadataInitializationKind) Foreign

func (k MetadataInitializationKind) Foreign() bool

func (MetadataInitializationKind) None

func (MetadataInitializationKind) Singleton

func (k MetadataInitializationKind) Singleton() bool

func (MetadataInitializationKind) String

type MetadataKind

type MetadataKind uint32
const (
	ClassMetadataKind                    MetadataKind = 0                                                        // class
	StructMetadataKind                   MetadataKind = 0 | MetadataKindIsNonHeap                                // struct
	EnumMetadataKind                     MetadataKind = 1 | MetadataKindIsNonHeap                                // enum
	OptionalMetadataKind                 MetadataKind = 2 | MetadataKindIsNonHeap                                // optional
	ForeignClassMetadataKind             MetadataKind = 3 | MetadataKindIsNonHeap                                // foreign class
	ForeignReferenceTypeMetadataKind     MetadataKind = 4 | MetadataKindIsNonHeap                                // foreign reference type
	OpaqueMetadataKind                   MetadataKind = 0 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap // opaque
	TupleMetadataKind                    MetadataKind = 1 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap // tuple
	FunctionMetadataKind                 MetadataKind = 2 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap // function
	ExistentialMetadataKind              MetadataKind = 3 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap // existential
	MetatypeMetadataKind                 MetadataKind = 4 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap // metatype
	ObjCClassWrapperMetadataKind         MetadataKind = 5 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap // objc class wrapper
	ExistentialMetatypeMetadataKind      MetadataKind = 6 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap // existential metatype
	ExtendedExistentialMetadataKind      MetadataKind = 7 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap // extended existential type
	HeapLocalVariableMetadataKind        MetadataKind = 0 | MetadataKindIsNonType                                // heap local variable
	HeapGenericLocalVariableMetadataKind MetadataKind = 0 | MetadataKindIsNonType | MetadataKindIsRuntimePrivate // heap generic local variable
	ErrorObjectMetadataKind              MetadataKind = 1 | MetadataKindIsNonType | MetadataKindIsRuntimePrivate // error object
	TaskMetadataKind                     MetadataKind = 2 | MetadataKindIsNonType | MetadataKindIsRuntimePrivate // task
	JobMetadataKind                      MetadataKind = 3 | MetadataKindIsNonType | MetadataKindIsRuntimePrivate // job
	// The largest possible non-isa-pointer metadata kind value.
	LastEnumerated = 0x7FF
)

func (MetadataKind) String

func (i MetadataKind) String() string

type MetadataSource

type MetadataSource struct {
	MetadataSourceRecord
	MangledType           string
	MangledMetadataSource string
}

type MetadataSourceRecord

type MetadataSourceRecord struct {
	MangledTypeNameOff       RelativeDirectPointer
	MangledMetadataSourceOff RelativeDirectPointer
}

func (*MetadataSourceRecord) Read

func (msr *MetadataSourceRecord) Read(r io.Reader, addr uint64) error

func (MetadataSourceRecord) Size

func (msr MetadataSourceRecord) Size() int64

type Method

type Method struct {
	TargetMethodDescriptor
	Address uint64
	Symbol  string
}

type MethodDescriptorFlags

type MethodDescriptorFlags uint32

func (MethodDescriptorFlags) ExtraDiscriminator

func (f MethodDescriptorFlags) ExtraDiscriminator() uint16

func (MethodDescriptorFlags) IsAsync

func (f MethodDescriptorFlags) IsAsync() bool

func (MethodDescriptorFlags) IsDynamic

func (f MethodDescriptorFlags) IsDynamic() bool

func (MethodDescriptorFlags) IsInstance

func (f MethodDescriptorFlags) IsInstance() bool

func (MethodDescriptorFlags) Kind

func (f MethodDescriptorFlags) Kind() MDKind

func (MethodDescriptorFlags) String

func (f MethodDescriptorFlags) String() string

func (MethodDescriptorFlags) Verbose

func (f MethodDescriptorFlags) Verbose() string

type MultiPayloadEnum

type MultiPayloadEnum struct {
	Address  uint64
	Type     string
	Contents []uint32
}

func (MultiPayloadEnum) String

func (e MultiPayloadEnum) String() string

type MultiPayloadEnumDescriptor

type MultiPayloadEnumDescriptor struct {
	TypeName int32
	Contents []uint32
}

ref: include/swift/RemoteInspection/Records.h

type MultiPayloadEnumPayloadSpareBitMaskByteCount

type MultiPayloadEnumPayloadSpareBitMaskByteCount uint32

func (MultiPayloadEnumPayloadSpareBitMaskByteCount) ByteCount

func (MultiPayloadEnumPayloadSpareBitMaskByteCount) ByteOffset

func (MultiPayloadEnumPayloadSpareBitMaskByteCount) String

type MultiPayloadEnumSizeAndFlags

type MultiPayloadEnumSizeAndFlags uint32

func (MultiPayloadEnumSizeAndFlags) Flags

func (MultiPayloadEnumSizeAndFlags) Size

func (MultiPayloadEnumSizeAndFlags) String

func (MultiPayloadEnumSizeAndFlags) UsesPayloadSpareBits

func (f MultiPayloadEnumSizeAndFlags) UsesPayloadSpareBits() bool

type NecessaryBindings

type NecessaryBindings struct {
	Kind               NecessaryBindingsKind
	RequirementsSet    RelativeDirectPointer
	RequirementsVector RelativeDirectPointer
	Conformances       RelativeDirectPointer
}

func (*NecessaryBindings) Read

func (nb *NecessaryBindings) Read(r io.Reader, addr uint64) error

func (NecessaryBindings) Size

func (nb NecessaryBindings) Size() int64

type NecessaryBindingsKind

type NecessaryBindingsKind uint32
const (
	PartialApply NecessaryBindingsKind = iota
	AsyncFunction
)

func (NecessaryBindingsKind) String

func (i NecessaryBindingsKind) String() string

type OpaqueType

type OpaqueType struct {
	TargetOpaqueTypeDescriptor
	GenericContext *GenericContext
	TypeArgs       []RelativeString
}

type PCDWitnessTable

type PCDWitnessTable struct {
	Address uint64
	Name    string
}

type Protocol

type Protocol struct {
	TargetProtocolDescriptor
	Address               uint64
	Name                  string
	Parent                *TargetModuleContext
	AssociatedTypes       []string
	SignatureRequirements []TargetGenericRequirement
	Requirements          []TargetProtocolRequirement
}

Protocol swift protocol object

func (Protocol) String

func (p Protocol) String() string

func (Protocol) Verbose

func (p Protocol) Verbose() string

type ProtocolContextDescriptorFlags

type ProtocolContextDescriptorFlags uint16

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

func (ProtocolContextDescriptorFlags) IsClassConstrained

func (f ProtocolContextDescriptorFlags) IsClassConstrained() bool

func (ProtocolContextDescriptorFlags) IsResilient

func (f ProtocolContextDescriptorFlags) IsResilient() bool

func (ProtocolContextDescriptorFlags) SpecialProtocol

func (f ProtocolContextDescriptorFlags) SpecialProtocol() SpecialProtocol

func (ProtocolContextDescriptorFlags) String

type ProtocolRequirementFlags

type ProtocolRequirementFlags uint32

func (ProtocolRequirementFlags) ExtraDiscriminator

func (f ProtocolRequirementFlags) ExtraDiscriminator() uint16

func (ProtocolRequirementFlags) IsAsync

func (f ProtocolRequirementFlags) IsAsync() bool

func (ProtocolRequirementFlags) IsFunctionImpl

func (f ProtocolRequirementFlags) IsFunctionImpl() bool

func (ProtocolRequirementFlags) IsInstance

func (f ProtocolRequirementFlags) IsInstance() bool

func (ProtocolRequirementFlags) IsSignedWithAddress

func (f ProtocolRequirementFlags) IsSignedWithAddress() bool

func (ProtocolRequirementFlags) Kind

func (ProtocolRequirementFlags) String

func (f ProtocolRequirementFlags) String() string

func (ProtocolRequirementFlags) Verbose

func (f ProtocolRequirementFlags) Verbose() string

type ProtocolRequirementKind

type ProtocolRequirementKind uint8
const (
	PRKindBaseProtocol                        ProtocolRequirementKind = iota // base protocol
	PRKindMethod                                                             // method
	PRKindInit                                                               // initializer
	PRKindGetter                                                             // getter
	PRKindSetter                                                             // setter
	PRKindReadCoroutine                                                      // read coroutine
	PRKindModifyCoroutine                                                    // modify coroutine
	PRKindAssociatedTypeAccessFunction                                       // associated type access function
	PRKindAssociatedConformanceAccessFunction                                // associated conformance access function
)

func (ProtocolRequirementKind) String

func (i ProtocolRequirementKind) String() string

type RelativeDirectPointer

type RelativeDirectPointer struct {
	Address uint64
	RelOff  int32
}

func (RelativeDirectPointer) GetAddress

func (r RelativeDirectPointer) GetAddress() uint64

func (RelativeDirectPointer) IsSet

func (r RelativeDirectPointer) IsSet() bool

func (*RelativeDirectPointer) Read

func (p *RelativeDirectPointer) Read(r io.Reader, addr uint64) error

type RelativeIndirectablePointer

type RelativeIndirectablePointer struct {
	Address uint64
	RelOff  int32
}

func (RelativeIndirectablePointer) GetAddress

func (ri RelativeIndirectablePointer) GetAddress(readPtr func(uint64) (uint64, error)) (uint64, error)

func (RelativeIndirectablePointer) GetRelPtrAddress

func (ri RelativeIndirectablePointer) GetRelPtrAddress() uint64

func (RelativeIndirectablePointer) IsSet

func (ri RelativeIndirectablePointer) IsSet() bool

type RelativeString

type RelativeString struct {
	RelativeDirectPointer
	Name string
}

type RelativeTargetProtocolDescriptorPointer

type RelativeTargetProtocolDescriptorPointer struct {
	Address uint64
	RelOff  int32
}

func (RelativeTargetProtocolDescriptorPointer) GetAddress

func (r RelativeTargetProtocolDescriptorPointer) GetAddress(readPtr func(uint64) (uint64, error)) (uint64, error)

func (RelativeTargetProtocolDescriptorPointer) GetRelPtrAddress

func (r RelativeTargetProtocolDescriptorPointer) GetRelPtrAddress() uint64

func (RelativeTargetProtocolDescriptorPointer) IsObjC

func (RelativeTargetProtocolDescriptorPointer) IsSet

func (RelativeTargetProtocolDescriptorPointer) String

type ResilientSuperclass

type ResilientSuperclass struct {
	TargetResilientSuperclass
	Type *Type
}

type ResilientWitnesses

type ResilientWitnesses struct {
	TargetResilientWitness
	Symbol      string
	Requirement TargetProtocolRequirement
}

type SpecialKind

type SpecialKind uint32
const (
	SKNone SpecialKind = 0 // none
	// The existential has a class constraint.
	// The inline storage is sizeof(void*) / alignof(void*),
	// the value is always stored inline, the value is reference-
	// counted (using unknown reference counting), and the
	// type metadata for the requirement generic parameters are
	// not stored in the existential container because they can
	// be recovered from the instance type of the class.
	SKClass SpecialKind = 1 // class
	// The existential has a metatype constraint.
	// The inline storage is sizeof(void*) / alignof(void*),
	// the value is always stored inline, the value is a Metadata*,
	// and the type metadata for the requirement generic parameters
	// are not stored in the existential container because they can
	// be recovered from the stored metatype.
	SKMetatype SpecialKind = 2 // metatype
	// The inline value storage has a non-storage layout.  The shape
	// must include a value witness table.  Type metadata for the
	// requirement generic parameters are still stored in the existential
	// container.
	SKExplicitLayout SpecialKind = 3 // explicit layout

)

func (SpecialKind) String

func (i SpecialKind) String() string

type SpecialPointerAuthDiscriminators

type SpecialPointerAuthDiscriminators uint16
const (

	/// HeapMetadataHeader::destroy
	DiscHeapDestructor SpecialPointerAuthDiscriminators = 0xbbbf

	/// Type descriptor data pointers.
	DiscTypeDescriptor SpecialPointerAuthDiscriminators = 0xae86

	/// Runtime function variables exported by the runtime.
	DiscRuntimeFunctionEntry SpecialPointerAuthDiscriminators = 0x625b

	/// Protocol conformance descriptors.
	DiscProtocolConformanceDescriptor SpecialPointerAuthDiscriminators = 0xc6eb

	/// Pointer to value witness table stored in type metadata.
	///
	/// Computed with ptrauth_string_discriminator("value_witness_table_t").
	DiscValueWitnessTable SpecialPointerAuthDiscriminators = 0x2e3f

	/// Extended existential type shapes.
	DiscExtendedExistentialTypeShape          SpecialPointerAuthDiscriminators = 0x5a3d // SpecialPointerAuthDiscriminators = 23101
	DiscNonUniqueExtendedExistentialTypeShape SpecialPointerAuthDiscriminators = 0xe798 // SpecialPointerAuthDiscriminators = 59288

	/// Value witness functions.
	DiscInitializeBufferWithCopyOfBuffer   SpecialPointerAuthDiscriminators = 0xda4a
	DiscDestroy                            SpecialPointerAuthDiscriminators = 0x04f8
	DiscInitializeWithCopy                 SpecialPointerAuthDiscriminators = 0xe3ba
	DiscAssignWithCopy                     SpecialPointerAuthDiscriminators = 0x8751
	DiscInitializeWithTake                 SpecialPointerAuthDiscriminators = 0x48d8
	DiscAssignWithTake                     SpecialPointerAuthDiscriminators = 0xefda
	DiscDestroyArray                       SpecialPointerAuthDiscriminators = 0x2398
	DiscInitializeArrayWithCopy            SpecialPointerAuthDiscriminators = 0xa05c
	DiscInitializeArrayWithTakeFrontToBack SpecialPointerAuthDiscriminators = 0x1c3e
	DiscInitializeArrayWithTakeBackToFront SpecialPointerAuthDiscriminators = 0x8dd3
	DiscStoreExtraInhabitant               SpecialPointerAuthDiscriminators = 0x79c5
	DiscGetExtraInhabitantIndex            SpecialPointerAuthDiscriminators = 0x2ca8
	DiscGetEnumTag                         SpecialPointerAuthDiscriminators = 0xa3b5
	DiscDestructiveProjectEnumData         SpecialPointerAuthDiscriminators = 0x041d
	DiscDestructiveInjectEnumTag           SpecialPointerAuthDiscriminators = 0xb2e4
	DiscGetEnumTagSinglePayload            SpecialPointerAuthDiscriminators = 0x60f0
	DiscStoreEnumTagSinglePayload          SpecialPointerAuthDiscriminators = 0xa0d1

	/// KeyPath metadata functions.
	DiscKeyPathDestroy           SpecialPointerAuthDiscriminators = 0x7072
	DiscKeyPathCopy              SpecialPointerAuthDiscriminators = 0x6f66
	DiscKeyPathEquals            SpecialPointerAuthDiscriminators = 0x756e
	DiscKeyPathHash              SpecialPointerAuthDiscriminators = 0x6374
	DiscKeyPathGetter            SpecialPointerAuthDiscriminators = 0x6f72
	DiscKeyPathNonmutatingSetter SpecialPointerAuthDiscriminators = 0x6f70
	DiscKeyPathMutatingSetter    SpecialPointerAuthDiscriminators = 0x7469
	DiscKeyPathGetLayout         SpecialPointerAuthDiscriminators = 0x6373
	DiscKeyPathInitializer       SpecialPointerAuthDiscriminators = 0x6275
	DiscKeyPathMetadataAccessor  SpecialPointerAuthDiscriminators = 0x7474

	/// ObjC bridging entry points.
	DiscObjectiveCTypeDiscriminator                    SpecialPointerAuthDiscriminators = 0x31c3 // SpecialPointerAuthDiscriminators = 12739
	DiscbridgeToObjectiveCDiscriminator                SpecialPointerAuthDiscriminators = 0xbca0 // SpecialPointerAuthDiscriminators = 48288
	DiscforceBridgeFromObjectiveCDiscriminator         SpecialPointerAuthDiscriminators = 0x22fb // SpecialPointerAuthDiscriminators = 8955
	DiscconditionallyBridgeFromObjectiveCDiscriminator SpecialPointerAuthDiscriminators = 0x9a9b // SpecialPointerAuthDiscriminators = 39579

	/// Dynamic replacement pointers.
	DiscDynamicReplacementScope SpecialPointerAuthDiscriminators = 0x48F0 // SpecialPointerAuthDiscriminators = 18672
	DiscDynamicReplacementKey   SpecialPointerAuthDiscriminators = 0x2C7D // SpecialPointerAuthDiscriminators = 11389

	/// Resume functions for yield-once coroutines that yield a single
	/// opaque borrowed/inout value.  These aren't actually hard-coded, but
	/// they're important enough to be worth writing in one place.
	DiscOpaqueReadResumeFunction   SpecialPointerAuthDiscriminators = 56769
	DiscOpaqueModifyResumeFunction SpecialPointerAuthDiscriminators = 3909

	/// ObjC class pointers.
	DiscObjCISA        SpecialPointerAuthDiscriminators = 0x6AE1
	DiscObjCSuperclass SpecialPointerAuthDiscriminators = 0xB5AB

	/// Resilient class stub initializer callback
	DiscResilientClassStubInitCallback SpecialPointerAuthDiscriminators = 0xC671

	/// Jobs, tasks, and continuations.
	DiscJobInvokeFunction                SpecialPointerAuthDiscriminators = 0xcc64 // SpecialPointerAuthDiscriminators = 52324
	DiscTaskResumeFunction               SpecialPointerAuthDiscriminators = 0x2c42 // SpecialPointerAuthDiscriminators = 11330
	DiscTaskResumeContext                SpecialPointerAuthDiscriminators = 0x753a // SpecialPointerAuthDiscriminators = 30010
	DiscAsyncRunAndBlockFunction         SpecialPointerAuthDiscriminators = 0x0f08 // 3848
	DiscAsyncContextParent               SpecialPointerAuthDiscriminators = 0xbda2 // SpecialPointerAuthDiscriminators = 48546
	DiscAsyncContextResume               SpecialPointerAuthDiscriminators = 0xd707 // SpecialPointerAuthDiscriminators = 55047
	DiscAsyncContextYield                SpecialPointerAuthDiscriminators = 0xe207 // SpecialPointerAuthDiscriminators = 57863
	DiscCancellationNotificationFunction SpecialPointerAuthDiscriminators = 0x1933 // SpecialPointerAuthDiscriminators = 6451
	DiscEscalationNotificationFunction   SpecialPointerAuthDiscriminators = 0x5be4 // SpecialPointerAuthDiscriminators = 23524
	DiscAsyncThinNullaryFunction         SpecialPointerAuthDiscriminators = 0x0f08 // SpecialPointerAuthDiscriminators = 3848
	DiscAsyncFutureFunction              SpecialPointerAuthDiscriminators = 0x720f // SpecialPointerAuthDiscriminators = 29199

	/// Swift async context parameter stored in the extended frame info.
	DiscSwiftAsyncContextExtendedFrameEntry SpecialPointerAuthDiscriminators = 0xc31a // SpecialPointerAuthDiscriminators = 49946

	// C type TaskContinuationFunction* descriminator.
	DiscClangTypeTaskContinuationFunction SpecialPointerAuthDiscriminators = 0x2abe // SpecialPointerAuthDiscriminators = 10942

	/// Dispatch integration.
	DiscDispatchInvokeFunction SpecialPointerAuthDiscriminators = 0xf493 // SpecialPointerAuthDiscriminators = 62611

	/// Functions accessible at runtime (i.e. distributed method accessors).
	DiscAccessibleFunctionRecord SpecialPointerAuthDiscriminators = 0x438c // = 17292
)

func (SpecialPointerAuthDiscriminators) String

type SpecialProtocol

type SpecialProtocol uint8

/ Identifiers for protocols with special meaning to the Swift runtime.

const (
	/// Not a special protocol.
	///
	/// This must be 0 for ABI compatibility with Objective-C protocol_t records.
	None SpecialProtocol = 0 // none
	/// The Error protocol.
	Error SpecialProtocol = 1 // error
)

func (SpecialProtocol) String

func (i SpecialProtocol) String() string

type TOC

type TOC struct {
	Builtins             int
	Fields               int
	Types                int
	AssociatedTypes      int
	Protocols            int
	ProtocolConformances int
}

TOC is a table of contents for Swift contents.

func (TOC) String

func (t TOC) String() string

type TargetAccessibleFunctionRecord

type TargetAccessibleFunctionRecord struct {
	Name               RelativeDirectPointer // char *
	GenericEnvironment RelativeDirectPointer // TargetGenericEnvironment
	FunctionType       RelativeDirectPointer // mangled name
	Function           RelativeDirectPointer // void *
	Flags              AccessibleFunctionFlags
}

func (*TargetAccessibleFunctionRecord) Read

func (TargetAccessibleFunctionRecord) Size

type TargetAnonymousContextDescriptor

type TargetAnonymousContextDescriptor struct {
	TargetContextDescriptor
}

func (TargetAnonymousContextDescriptor) HasMangledName

func (tacd TargetAnonymousContextDescriptor) HasMangledName() bool

func (*TargetAnonymousContextDescriptor) Read

func (TargetAnonymousContextDescriptor) Size

type TargetCanonicalSpecializedMetadataAccessorsListEntry

type TargetCanonicalSpecializedMetadataAccessorsListEntry struct {
	Accessor RelativeDirectPointer
}

func (*TargetCanonicalSpecializedMetadataAccessorsListEntry) Read

func (TargetCanonicalSpecializedMetadataAccessorsListEntry) Size

type TargetCanonicalSpecializedMetadatasCachingOnceToken

type TargetCanonicalSpecializedMetadatasCachingOnceToken struct {
	Token TargetRelativeDirectPointer
}

func (*TargetCanonicalSpecializedMetadatasCachingOnceToken) Read

func (TargetCanonicalSpecializedMetadatasCachingOnceToken) Size

type TargetCanonicalSpecializedMetadatasListCount

type TargetCanonicalSpecializedMetadatasListCount struct {
	Count uint32
}

type TargetCanonicalSpecializedMetadatasListEntry

type TargetCanonicalSpecializedMetadatasListEntry struct {
	Metadata RelativeDirectPointer // TargetMetadata
}

func (*TargetCanonicalSpecializedMetadatasListEntry) Read

func (TargetCanonicalSpecializedMetadatasListEntry) Size

type TargetClassDescriptor

type TargetClassDescriptor struct {
	TargetTypeContextDescriptor
	// The type of the superclass, expressed as a mangled type name that can
	// refer to the generic arguments of the subclass type.
	SuperclassType RelativeDirectPointer
	// [MetadataNegativeSizeInWords] (uint32)
	//   If this descriptor does not have a resilient superclass, this is the
	//   negative size of metadata objects of this class (in words).
	// [ResilientMetadataBounds] (TargetRelativeDirectPointer)
	//   If this descriptor has a resilient superclass, this is a reference
	//   to a cache holding the metadata's extents.
	MetadataNegativeSizeInWordsORResilientMetadataBounds uint32 // UNION
	// [MetadataPositiveSizeInWords] (uint32)
	//   If this descriptor does not have a resilient superclass, this is the
	//   positive size of metadata objects of this class (in words).
	// [ExtraClassFlags] (ExtraClassDescriptorFlags)
	//   Otherwise, these flags are used to do things like indicating
	//   the presence of an Objective-C resilient class stub.
	MetadataPositiveSizeInWordsORExtraClassFlags uint32 // UNION
	// The number of additional members added by this class to the class
	// metadata.  This data is opaque by default to the runtime, other than
	// as exposed in other members; it's really just
	// NumImmediateMembers * sizeof(void*) bytes of data.
	//
	// Whether those bytes are added before or after the address point
	// depends on areImmediateMembersNegative().
	NumImmediateMembers uint32
	// The number of stored properties in the class, not including its
	// superclasses. If there is a field offset vector, this is its length.
	NumFields uint32
	// The offset of the field offset vector for this class's stored
	// properties in its metadata, in words. 0 means there is no field offset vector.
	//
	// If this class has a resilient superclass, this offset is relative to
	// the size of the resilient superclass metadata. Otherwise, it is absolute.
	FieldOffsetVectorOffset uint32
}

func (TargetClassDescriptor) HasObjCResilientClassStub

func (c TargetClassDescriptor) HasObjCResilientClassStub() bool

func (*TargetClassDescriptor) Read

func (c *TargetClassDescriptor) Read(r io.Reader, addr uint64) error

func (TargetClassDescriptor) Size

func (tcd TargetClassDescriptor) Size() int64

type TargetContextDescriptor

type TargetContextDescriptor struct {
	Flags        ContextDescriptorFlags // Flags describing the context, including its kind and format version.
	ParentOffset RelativeDirectPointer  // The parent context, or null if this is a top-level context.
}

TargetContextDescriptor base class for all context descriptors.

func (*TargetContextDescriptor) Read

func (cd *TargetContextDescriptor) Read(r io.Reader, addr uint64) error

func (TargetContextDescriptor) Size

func (cd TargetContextDescriptor) Size() int64

type TargetEnumDescriptor

type TargetEnumDescriptor struct {
	TargetTypeContextDescriptor
	NumPayloadCasesAndPayloadSizeOffset uint32
	NumEmptyCases                       uint32
}

func (TargetEnumDescriptor) GetNumCases

func (e TargetEnumDescriptor) GetNumCases() uint32

func (TargetEnumDescriptor) GetNumPayloadCases

func (e TargetEnumDescriptor) GetNumPayloadCases() uint32

func (TargetEnumDescriptor) GetPayloadSizeOffset

func (e TargetEnumDescriptor) GetPayloadSizeOffset() uint32

func (*TargetEnumDescriptor) Read

func (e *TargetEnumDescriptor) Read(r io.Reader, addr uint64) error

func (TargetEnumDescriptor) Size

func (e TargetEnumDescriptor) Size() int64

func (TargetEnumDescriptor) String

func (e TargetEnumDescriptor) String() string

type TargetEnumValueWitnessTable

type TargetEnumValueWitnessTable struct {
	GetEnumTagFn                 uint64
	DestructiveProjectEnumDataFn uint64
	DestructiveInjectEnumTagFn   uint64
}

func (*TargetEnumValueWitnessTable) Fixup

func (ew *TargetEnumValueWitnessTable) Fixup(fix func(uint64) uint64)

type TargetExtendedExistentialTypeShape

type TargetExtendedExistentialTypeShape struct {
	// Flags for the existential shape.
	Flags ExtendedExistentialTypeShapeFlags
	// The mangling of the generalized existential type, expressed
	// (if necessary) in terms of the type parameters of the
	// generalization signature.
	//
	// If this shape is non-unique, this is always a flat string, not a
	// "symbolic" mangling which can contain relative references.  This
	// allows uniquing to simply compare the string content.
	//
	// In principle, the content of the requirement signature and type
	// expression are derivable from this type.  We store them separately
	// so that code which only needs to work with the logical content of
	// the type doesn't have to break down the existential type string.
	// This both (1) allows those operations to work substantially more
	// efficiently (and without needing code to produce a requirement
	// signature from an existential type to exist in the runtime) and
	// (2) potentially allows old runtimes to support new existential
	// types without as much invasive code.
	//
	// The content of this string is *not* necessarily derivable from
	// the requirement signature.  This is because there may be multiple
	// existential types that have equivalent logical content but which
	// we nonetheless distinguish at compile time.  Storing this also
	// allows us to far more easily produce a formal type from this
	// shape reflectively.
	ExistentialType RelativeDirectPointer
	// The header describing the requirement signature of the existential.
	ReqSigHeader RelativeDirectPointer // TargetGenericContextDescriptorHeader
}

TargetExtendedExistentialTypeShape a description of the shape of an existential type.

func (*TargetExtendedExistentialTypeShape) Read

func (TargetExtendedExistentialTypeShape) Size

func (TargetExtendedExistentialTypeShape) String

type TargetExtensionContextDescriptor

type TargetExtensionContextDescriptor struct {
	TargetContextDescriptor
	// A mangling of the `Self` type context that the extension extends.
	// The mangled name represents the type in the generic context encoded by
	// this descriptor. For example, a nongeneric nominal type extension will
	// encode the nominal type name. A generic nominal type extension will encode
	// the instance of the type with any generic arguments bound.
	//
	// Note that the Parent of the extension will be the module context the
	// extension is declared inside.
	ExtendedContext RelativeDirectPointer
}

func (*TargetExtensionContextDescriptor) Read

func (TargetExtensionContextDescriptor) Size

type TargetForeignMetadataInitialization

type TargetForeignMetadataInitialization struct {
	CompletionFunction RelativeDirectPointer // The completion function. The pattern will always be null.
}

TargetForeignMetadataInitialization is the control structure for performing non-trivial initialization of singleton foreign metadata.

func (*TargetForeignMetadataInitialization) Read

func (TargetForeignMetadataInitialization) Size

type TargetGenericClassMetadataPattern

type TargetGenericClassMetadataPattern struct {
	Destroy       int32      // The heap-destructor function.
	IVarDestroyer int32      // The ivar-destructor function.
	Flags         ClassFlags // The class flags.
	// The following fields are only present in ObjC interop.
	ClassRODataOffset     uint16 // The offset of the class RO-data within the extra data pattern, in words.
	MetaclassObjectOffset uint16 // The offset of the metaclass object within the extra data pattern, in words.
	MetaclassRODataOffset uint16 // The offset of the metaclass RO-data within the extra data pattern, in words.
	Reserved              uint16
}

An instantiation pattern for generic class metadata.

type TargetGenericContextDescriptorHeader

type TargetGenericContextDescriptorHeader struct {
	// The number of (source-written) generic parameters, and thus
	// the number of GenericParamDescriptors associated with this
	// context.  The parameter descriptors appear in the order in
	// which they were given in the source.
	//
	// A GenericParamDescriptor corresponds to a type metadata pointer
	// in the arguments layout when isKeyArgument() is true.
	// isKeyArgument() will be false if the parameter has been made
	// equivalent to a different parameter or a concrete type.
	NumParams uint16
	// The number of GenericRequirementDescriptors in this generic
	// signature.
	//
	// A GenericRequirementDescriptor of kind Protocol corresponds
	// to a witness table pointer in the arguments layout when
	// isKeyArgument() is true.  isKeyArgument() will be false if
	// the protocol is an Objective-C protocol.  (Unlike generic
	// parameters, redundant conformance requirements can simply be
	// eliminated, and so that case is not impossible.)
	NumRequirements uint16
	// The size of the "key" area of the argument layout, in words.
	// Key arguments include shape classes, generic parameters and
	// conformance requirements which are part of the identity of
	// the context.
	//
	// The key area of the argument layout consists of:
	//
	// - a sequence of pack lengths, in the same order as the parameter
	//   descriptors which satisfy getKind() == GenericParamKind::TypePack
	//   and hasKeyArgument();
	//
	// - a sequence of metadata or metadata pack pointers, in the same
	//   order as the parameter descriptors which satisfy hasKeyArgument();
	//
	// - a sequence of witness table or witness table pack pointers, in the
	//   same order as the requirement descriptors which satisfy
	//   hasKeyArgument().
	//
	// The elements above which are packs are precisely those appearing
	// in the sequence of trailing GenericPackShapeDescriptors.
	NumKeyArguments uint16
	// Originally this was the size of the "extra" area of the argument
	// layout, in words.  The idea was that extra arguments would
	// include generic parameters and conformances that are not part
	// of the identity of the context; however, it's unclear why we
	// would ever want such a thing.  As a result, in pre-5.8 runtimes
	// this field is always zero.  New flags can only be added as long
	// as they remains zero in code which must be compatible with
	// older Swift runtimes.
	Flags GenericContextDescriptorFlags
}

ref: include/swift/ABI/GenericContext.h

func (TargetGenericContextDescriptorHeader) GetNumArguments

func (g TargetGenericContextDescriptorHeader) GetNumArguments() uint16

func (TargetGenericContextDescriptorHeader) HasArguments

func (g TargetGenericContextDescriptorHeader) HasArguments() bool

type TargetGenericEnvironment

type TargetGenericEnvironment struct {
	Flags GenericEnvironmentFlags
}

type TargetGenericMetadataInstantiationCache

type TargetGenericMetadataInstantiationCache struct {
	// Data that the runtime can use for its own purposes.  It is guaranteed
	// to be zero-filled by the compiler. Might be null when building with
	// -disable-preallocated-instantiation-caches.
	PrivateData [16]byte
}

The instantiation cache for generic metadata. This must be guaranteed to zero-initialized before it is first accessed. Its contents are private to the runtime.

type TargetGenericMetadataPartialPattern

type TargetGenericMetadataPartialPattern struct {
	Pattern       TargetRelativeDirectPointer // A reference to the pattern.  The pattern must always be at least word-aligned.
	OffsetInWords uint16                      // The offset into the section into which to copy this pattern, in words.
	SizeInWords   uint16                      // The size of the pattern in words.
}

TargetGenericMetadataPartialPattern part of a generic metadata instantiation pattern.

func (*TargetGenericMetadataPartialPattern) Read

type TargetGenericMetadataPattern

type TargetGenericMetadataPattern struct {
	InstantiationFunction RelativeDirectPointer
	CompletionFunction    RelativeDirectPointer
	PatternFlags          GenericMetadataPatternFlags
}

func (*TargetGenericMetadataPattern) Read

type TargetGenericRequirement

type TargetGenericRequirement struct {
	TargetGenericRequirementDescriptor
	Param string
	Kind  string
}

type TargetGenericRequirementDescriptor

type TargetGenericRequirementDescriptor struct {
	Flags                                  GenericRequirementFlags
	ParamOff                               RelativeDirectPointer       // The type that's constrained, described as a mangled name.
	TypeOrProtocolOrConformanceOrLayoutOff RelativeIndirectablePointer // UNION: flags determine type
}

ref: swift/ABI/Metadata.h - TargetGenericRequirementDescriptor

func (*TargetGenericRequirementDescriptor) Read

func (TargetGenericRequirementDescriptor) Size

type TargetGenericValueMetadataPattern

type TargetGenericValueMetadataPattern struct {
	/// The value-witness table.  Indirectable so that we can re-use tables
	/// from other libraries if that seems wise.
	ValueWitnesses RelativeIndirectablePointer
}

An instantiation pattern for generic value metadata.

type TargetGenericWitnessTable

type TargetGenericWitnessTable struct {
	WitnessTableSizeInWords                                uint16
	WitnessTablePrivateSizeInWordsAndRequiresInstantiation uint16
	Instantiator                                           int32
	PrivateData                                            int32
}

TargetGenericWitnessTable object ref: swift/ABI/Metadata.h - TargetGenericWitnessTable

type TargetMangledContextName

type TargetMangledContextName struct {
	Name RelativeDirectPointer
}

func (*TargetMangledContextName) Read

func (m *TargetMangledContextName) Read(r io.Reader, addr uint64) error

func (TargetMangledContextName) Size

type TargetMetadata

type TargetMetadata struct {
	Kind                uint64
	TypeDescriptor      uint64
	TypeMetadataAddress uint64
}

TargetMetadata the common structure of all type metadata.

func (TargetMetadata) GetKind

func (m TargetMetadata) GetKind() MetadataKind

type TargetMethodDescriptor

type TargetMethodDescriptor struct {
	Flags MethodDescriptorFlags
	Impl  TargetRelativeDirectPointer
}

func (*TargetMethodDescriptor) Read

func (md *TargetMethodDescriptor) Read(r io.Reader, addr uint64) error

func (TargetMethodDescriptor) Size

func (md TargetMethodDescriptor) Size() int64

type TargetMethodOverrideDescriptor

type TargetMethodOverrideDescriptor struct {
	// The class containing the base method.
	Class RelativeDirectPointer
	// The base method.
	Method RelativeDirectPointer
	// The implementation of the override.
	Impl RelativeDirectPointer // UNION
}

An entry in the method override table, referencing a method from one of our ancestor classes, together with an implementation.

func (*TargetMethodOverrideDescriptor) Read

func (TargetMethodOverrideDescriptor) Size

func (TargetMethodOverrideDescriptor) String

type TargetModuleContext

type TargetModuleContext struct {
	TargetModuleContextDescriptor
	Name   string
	Parent string
}

type TargetModuleContextDescriptor

type TargetModuleContextDescriptor struct {
	TargetContextDescriptor
	NameOffset RelativeDirectPointer
}

func (*TargetModuleContextDescriptor) Read

func (tmcd *TargetModuleContextDescriptor) Read(r io.Reader, addr uint64) error

func (TargetModuleContextDescriptor) Size

type TargetNonUniqueExtendedExistentialTypeShape

type TargetNonUniqueExtendedExistentialTypeShape struct {
	// A reference to memory that can be used to cache a globally-unique
	// descriptor for this existential shape.
	UniqueCache RelativeDirectPointer // TargetExtendedExistentialTypeShape
	// The local copy of the existential shape descriptor.
	LocalCopy TargetExtendedExistentialTypeShape // TargetExtendedExistentialTypeShape
}

TargetNonUniqueExtendedExistentialTypeShape a descriptor for an extended existential type descriptor which needs to be uniqued at runtime.

func (*TargetNonUniqueExtendedExistentialTypeShape) Read

func (TargetNonUniqueExtendedExistentialTypeShape) Size

type TargetObjCResilientClassStubInfo

type TargetObjCResilientClassStubInfo struct {
	// A relative pointer to an Objective-C resilient class stub.
	//
	// We do not declare a struct type for class stubs since the Swift runtime
	// does not need to interpret them. The class stub struct is part of
	// the Objective-C ABI, and is laid out as follows:
	// - isa pointer, always 1
	// - an update callback, of type 'Class (*)(Class *, objc_class_stub *)'
	//
	// Class stubs are used for two purposes:
	//
	// - Objective-C can reference class stubs when calling static methods.
	// - Objective-C and Swift can reference class stubs when emitting
	//   categories (in Swift, extensions with @objc members).
	Stub TargetRelativeDirectPointer
}

TargetObjCResilientClassStubInfo structure that stores a reference to an Objective-C class stub.

This is not the class stub itself; it is part of a class context descriptor.

func (*TargetObjCResilientClassStubInfo) Read

func (TargetObjCResilientClassStubInfo) Size

type TargetOpaqueTypeDescriptor

type TargetOpaqueTypeDescriptor struct {
	TargetContextDescriptor
}

TargetOpaqueTypeDescriptor the descriptor for an opaque type.

func (*TargetOpaqueTypeDescriptor) Read

func (otd *TargetOpaqueTypeDescriptor) Read(r io.Reader, addr uint64) error

func (TargetOpaqueTypeDescriptor) Size

func (otd TargetOpaqueTypeDescriptor) Size() int64

type TargetOverrideTableHeader

type TargetOverrideTableHeader struct {
	// The number of MethodOverrideDescriptor records following the vtable
	// override header in the class's nominal type descriptor.
	NumEntries uint32
}

Header for a class vtable override descriptor. This is a variable-sized structure that provides implementations for overrides of methods defined in superclasses.

type TargetProtocolConformanceDescriptor

type TargetProtocolConformanceDescriptor struct {
	ProtocolOffsest            RelativeIndirectablePointer // The protocol being conformed to.
	TypeRefOffsest             RelativeIndirectablePointer // Some description of the type that conforms to the protocol.
	WitnessTablePatternOffsest RelativeDirectPointer       // The witness table pattern, which may also serve as the witness table.
	Flags                      ConformanceFlags            // Various flags, including the kind of conformance.
}

TargetProtocolConformanceDescriptor the structure of a protocol conformance.

func (*TargetProtocolConformanceDescriptor) Read

func (TargetProtocolConformanceDescriptor) Size

type TargetProtocolDescriptor

type TargetProtocolDescriptor struct {
	TargetContextDescriptor
	NameOffset                 RelativeDirectPointer // The name of the protocol.
	NumRequirementsInSignature uint32                // The number of generic requirements in the requirement signature of the protocol.
	NumRequirements            uint32                /* The number of requirements in the protocol. If any requirements beyond MinimumWitnessTableSizeInWords are present
	 * in the witness table template, they will be not be overwritten with defaults. */
	AssociatedTypeNamesOffset RelativeDirectPointer // Associated type names, as a space-separated list in the same order as the requirements.
}

TargetProtocolDescriptor ref: include/swift/ABI/MetadataValues.h

func (*TargetProtocolDescriptor) Read

func (d *TargetProtocolDescriptor) Read(r io.Reader, addr uint64) error

func (TargetProtocolDescriptor) Size

type TargetProtocolRecord

type TargetProtocolRecord struct {
	Protocol int32 // The protocol referenced (the remaining low bit is reserved for future use)
}

TargetProtocolRecord the structure of a protocol reference record. ref: swift/ABI/Metadata.h

type TargetProtocolRequirement

type TargetProtocolRequirement struct {
	Flags                 ProtocolRequirementFlags
	DefaultImplementation RelativeDirectPointer // The optional default implementation of the protocol.
}

TargetProtocolRequirement protocol requirement descriptor. This describes a single protocol requirement in a protocol descriptor. The index of the requirement in the descriptor determines the offset of the witness in a witness table for this protocol. ref: swift/ABI/Metadata.h - TargetProtocolRequirement

func (*TargetProtocolRequirement) Read

func (pr *TargetProtocolRequirement) Read(r io.Reader, addr uint64) error

func (TargetProtocolRequirement) Size

func (pr TargetProtocolRequirement) Size() int64

type TargetRelativeDirectPointer

type TargetRelativeDirectPointer struct {
	Address uint64
	RelOff  int32
}

func (TargetRelativeDirectPointer) GetAddress

func (tr TargetRelativeDirectPointer) GetAddress(r io.Reader) (uint64, error)

func (TargetRelativeDirectPointer) GetRelPtrAddress

func (tr TargetRelativeDirectPointer) GetRelPtrAddress() uint64

func (TargetRelativeDirectPointer) IsSet

func (tr TargetRelativeDirectPointer) IsSet() bool

type TargetResilientClassMetadataPattern

type TargetResilientClassMetadataPattern struct {
	/// A function that allocates metadata with the correct size at runtime.
	///
	/// If this is null, the runtime instead calls swift_relocateClassMetadata(),
	/// passing in the class descriptor and this pattern.
	RelocationFunction int32
	/// The heap-destructor function.
	Destroy int32
	/// The ivar-destructor function.
	IVarDestroyer int32
	// The class flags.
	Flags ClassFlags

	/// Our ClassROData.
	Data int32
	/// Our metaclass.
	Metaclass int32
}

An instantiation pattern for non-generic resilient class metadata.

Used for classes with resilient ancestry, that is, where at least one ancestor is defined in a different resilience domain.

The hasResilientSuperclass() flag in the class context descriptor is set in this case, and hasSingletonMetadataInitialization() must be set as well.

The pattern is referenced from the SingletonMetadataInitialization record in the class context descriptor.

type TargetResilientSuperclass

type TargetResilientSuperclass struct {
	// The superclass of this class.  This pointer can be interpreted
	// using the superclass reference kind stored in the type context
	// descriptor flags.  It is null if the class has no formal superclass.
	//
	// Note that SwiftObject, the implicit superclass of all Swift root
	// classes when building with ObjC compatibility, does not appear here.
	Superclass RelativeDirectPointer
}

func (*TargetResilientSuperclass) Read

func (t *TargetResilientSuperclass) Read(r io.Reader, addr uint64) error

func (TargetResilientSuperclass) Size

type TargetResilientWitness

type TargetResilientWitness struct {
	RequirementOff RelativeIndirectablePointer
	ImplOff        RelativeDirectPointer
}

TargetResilientWitness object ref: swift/ABI/Metadata.h - TargetResilientWitness

func (*TargetResilientWitness) Read

func (rw *TargetResilientWitness) Read(r io.Reader, addr uint64) error

func (TargetResilientWitness) Size

func (rw TargetResilientWitness) Size() int64

type TargetResilientWitnessesHeader

type TargetResilientWitnessesHeader struct {
	NumWitnesses uint32
}

TargetResilientWitnessesHeader a header containing information about the resilient witnesses in a protocol conformance descriptor. ref: swift/ABI/Metadata.h - TargetResilientWitnessesHeader

type TargetSingletonMetadataInitialization

type TargetSingletonMetadataInitialization struct {
	InitializationCacheOffset TargetRelativeDirectPointer // The initialization cache. Out-of-line because mutable.
	IncompleteMetadata        TargetRelativeDirectPointer // UNION: The incomplete metadata, for structs, enums and classes without resilient ancestry.
	// ResilientPattern
	// If the class descriptor's hasResilientSuperclass() flag is set,
	// this field instead points at a pattern used to allocate and
	// initialize metadata for this class, since it's size and contents
	// is not known at compile time.
	CompletionFunction TargetRelativeDirectPointer // The completion function. The pattern will always be null, even for a resilient class.
}

func (*TargetSingletonMetadataInitialization) Read

func (TargetSingletonMetadataInitialization) Size

type TargetStructDescriptor

type TargetStructDescriptor struct {
	TargetTypeContextDescriptor
	// The number of stored properties in the struct.
	// If there is a field offset vector, this is its length.
	NumFields uint32
	// The offset of the field offset vector for this struct's stored
	// properties in its metadata, if any. 0 means there is no field offset vector.
	FieldOffsetVectorOffset uint32
}

func (*TargetStructDescriptor) Read

func (s *TargetStructDescriptor) Read(r io.Reader, addr uint64) error

func (TargetStructDescriptor) Size

func (s TargetStructDescriptor) Size() int64

type TargetTypeContextDescriptor

type TargetTypeContextDescriptor struct {
	TargetContextDescriptor
	NameOffset        RelativeDirectPointer // The name of the type.
	AccessFunctionPtr RelativeDirectPointer // A pointer to the metadata access function for this type.
	FieldsOffset      RelativeDirectPointer // A pointer to the field descriptor for the type, if any.
}

TargetTypeContextDescriptor object

func (*TargetTypeContextDescriptor) Read

func (tcd *TargetTypeContextDescriptor) Read(r io.Reader, addr uint64) error

func (TargetTypeContextDescriptor) Size

type TargetTypeGenericContextDescriptorHeader

type TargetTypeGenericContextDescriptorHeader struct {
	InstantiationCache          RelativeDirectPointer
	DefaultInstantiationPattern RelativeDirectPointer
	Base                        TargetGenericContextDescriptorHeader
}

func (*TargetTypeGenericContextDescriptorHeader) Read

func (TargetTypeGenericContextDescriptorHeader) Size

type TargetTypeMetadataHeader

type TargetTypeMetadataHeader struct {
	LayoutString   uint64
	ValueWitnesses uint64
}

type TargetVTableDescriptorHeader

type TargetVTableDescriptorHeader struct {
	VTableOffset uint32
	VTableSize   uint32
}

type TargetValueMetadata

type TargetValueMetadata struct {
	Description uint64 // An out-of-line description of the type. (signed pointer to TargetValueTypeDescriptor)
}

type TargetValueTypeDescriptor

type TargetValueTypeDescriptor TargetTypeContextDescriptor

type TargetValueWitnessFlags

type TargetValueWitnessFlags uint32

TargetValueWitnessFlags flags stored in the value-witness table.

const (
	AlignmentMask TargetValueWitnessFlags = 0x000000FF
	// unused             0x0000FF00
	IsNonPOD    TargetValueWitnessFlags = 0x00010000
	IsNonInline TargetValueWitnessFlags = 0x00020000
	// unused             0x00040000
	HasSpareBits        TargetValueWitnessFlags = 0x00080000
	IsNonBitwiseTakable TargetValueWitnessFlags = 0x00100000
	HasEnumWitnesses    TargetValueWitnessFlags = 0x00200000
	Incomplete          TargetValueWitnessFlags = 0x00400000
	IsNonCopyable       TargetValueWitnessFlags = 0x00800000
	// unused             0xFF000000
	TVWFMaxNumExtraInhabitants = 0x7FFFFFFF
)

The polarity of these bits is chosen so that, when doing struct layout, the flags of the field types can be mostly bitwise-or'ed together to derive the flags for the struct. (The "non-inline" and "has-extra-inhabitants" bits still require additional fixup.)

type TargetValueWitnessTable

type TargetValueWitnessTable struct {
	InitializeBufferWithCopyOfBufferFn uint64
	DestroyFn                          uint64
	InitializeWithCopyFn               uint64
	AssignWithCopyFn                   uint64
	InitializeWithTakeFn               uint64
	AssignWithTakeFn                   uint64
	GetEnumTagSinglePayloadFn          uint64
	StoreEnumTagSinglePayloadFn        uint64
	Size                               uint64 // the size of this type.  Unlike in C, this has not been padded up to the alignment; that value is maintained as 'stride'.
	Stride                             uint64 //  This is the size rounded up to be a multiple of the alignment.
	WitnessFlags                       TargetValueWitnessFlags
	ExtraInhabitantCount               uint32 // The number of extra inhabitants, that is, bit patterns that do not form valid values of the type, in this type's binary representation.
}

TargetValueWitnessTable a value-witness table. A value witness table is built around the requirements of some specific type. The information in a value-witness table is intended to be sufficient to lay out and manipulate values of an arbitrary type.

func (*TargetValueWitnessTable) Fixup

func (t *TargetValueWitnessTable) Fixup(fix func(uint64) uint64)

func (TargetValueWitnessTable) Flags

func (t TargetValueWitnessTable) Flags() string

func (TargetValueWitnessTable) GetAlignment

func (t TargetValueWitnessTable) GetAlignment() uint32

func (TargetValueWitnessTable) HasEnumWitnesses

func (t TargetValueWitnessTable) HasEnumWitnesses() bool

func (TargetValueWitnessTable) IsBitwiseTakable

func (t TargetValueWitnessTable) IsBitwiseTakable() bool

func (TargetValueWitnessTable) IsCopyable

func (t TargetValueWitnessTable) IsCopyable() bool

func (TargetValueWitnessTable) IsIncomplete

func (t TargetValueWitnessTable) IsIncomplete() bool

func (TargetValueWitnessTable) IsInlineStorage

func (t TargetValueWitnessTable) IsInlineStorage() bool

func (TargetValueWitnessTable) IsPOD

func (t TargetValueWitnessTable) IsPOD() bool

func (TargetValueWitnessTable) IsValueInline

func (t TargetValueWitnessTable) IsValueInline() bool

type TargetWitnessTable

type TargetWitnessTable struct {
	/// The protocol conformance descriptor from which this witness table
	/// was generated.
	Description int32
}

A witness table for a protocol.

With the exception of the initial protocol conformance descriptor, the layout of a witness table is dependent on the protocol being represented.

type Type

type Type struct {
	Address        uint64
	Parent         *Type
	Name           string
	ImportInfo     string
	Kind           ContextDescriptorKind
	AccessFunction uint64
	Fields         *Field
	Type           any
	Size           int64
}

func (Type) IsCImportedModuleName

func (t Type) IsCImportedModuleName() bool

func (Type) String

func (t Type) String() string

func (Type) Verbose

func (t Type) Verbose() string

type TypeContextDescriptorFlags

type TypeContextDescriptorFlags uint16

func (TypeContextDescriptorFlags) AreImmediateMembersNegative

func (f TypeContextDescriptorFlags) AreImmediateMembersNegative() bool

func (TypeContextDescriptorFlags) HasCanonicalMetadataPrespecializations

func (f TypeContextDescriptorFlags) HasCanonicalMetadataPrespecializations() bool

func (TypeContextDescriptorFlags) HasImportInfo

func (f TypeContextDescriptorFlags) HasImportInfo() bool

func (TypeContextDescriptorFlags) HasLayoutString

func (f TypeContextDescriptorFlags) HasLayoutString() bool

func (TypeContextDescriptorFlags) HasOverrideTable

func (f TypeContextDescriptorFlags) HasOverrideTable() bool

func (TypeContextDescriptorFlags) HasResilientSuperclass

func (f TypeContextDescriptorFlags) HasResilientSuperclass() bool

func (TypeContextDescriptorFlags) HasVTable

func (f TypeContextDescriptorFlags) HasVTable() bool

func (TypeContextDescriptorFlags) IsActor

func (f TypeContextDescriptorFlags) IsActor() bool

func (TypeContextDescriptorFlags) IsDefaultActor

func (f TypeContextDescriptorFlags) IsDefaultActor() bool

func (TypeContextDescriptorFlags) MetadataInitialization

func (f TypeContextDescriptorFlags) MetadataInitialization() MetadataInitializationKind

func (TypeContextDescriptorFlags) ResilientSuperclassReferenceKind

func (f TypeContextDescriptorFlags) ResilientSuperclassReferenceKind() TypeReferenceKind

func (TypeContextDescriptorFlags) String

type TypeGenericContext

type TypeGenericContext struct {
	TargetTypeGenericContextDescriptorHeader
	GenericMetadataPattern *GenericMetadataPattern
	Parameters             []GenericParamDescriptor
	Requirements           []TargetGenericRequirement
	TypePacks              []GenericPackShapeDescriptor
}

type TypeReferenceKind

type TypeReferenceKind uint8

TypeReferenceKind kinds of type metadata/protocol conformance records.

const (
	//The conformance is for a nominal type referenced directly; getTypeDescriptor() points to the type context descriptor.
	DirectTypeDescriptor TypeReferenceKind = 0x00 // direct
	// The conformance is for a nominal type referenced indirectly; getTypeDescriptor() points to the type context descriptor.
	IndirectTypeDescriptor TypeReferenceKind = 0x01 // indirect
	// The conformance is for an Objective-C class that should be looked up by class name.
	DirectObjCClassName TypeReferenceKind = 0x02 // direct_objc_class
	// 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.
	IndirectObjCClass TypeReferenceKind = 0x03 // indirect_objc_class
	// We only reserve three bits for this in the various places we store it.
	FirstKind = DirectTypeDescriptor
	LastKind  = IndirectObjCClass
)

func (TypeReferenceKind) String

func (i TypeReferenceKind) String() string

type VTable

type VTable struct {
	TargetVTableDescriptorHeader
	Methods []Method
}

type ValueWitnessTable

type ValueWitnessTable struct {
	RelativeDirectPointer
	TargetValueWitnessTable
	EnumWitnessTable *TargetEnumValueWitnessTable
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL