I am sorry, there's a lot of Swift reflection questions I have here. Feel free to only answer a subset. Thank you in advance for your help.
Looking at the Swift C++ APIs for reflection on Swift structs descriptors, I am having a hard time seeing if it's possible to find a way to access a
StructDescriptor's methods (read: just methods, not ivars) via the C++ reflection APIs in
Just for reference, going after a
ClassDescriptor's methods have been very straightforward as I'll use
getMethodDescriptorsfound here: https://github.com/apple/swift/blob/6295cecfa77ac4f10a5569930bba26d1934972ff/include/swift/ABI/Metadata.h#L3997 I don't see a clear way to do the equivalent for a
Can you explain the use of
StructDescriptor? I am having a hard time understanding it and how to practically apply it via the C++ APIs. I am aware of
TrailingGenericContextObjects, but don't know if
FieldOffsetVectorOffsetapplies to this or not or how it's used.
https://github.com/apple/swift/blob/master/docs/ABI/TypeMetadata.rst#common-metadata-layout has the following statement: "The value witness table pointer is at offset -1 from the metadata pointer, that is, the pointer-sized word immediately before the pointer's referenced address."
How to I programmatically obtain the "value witness table" if I have a reference to a
StructDescriptor*?. I thought the
Fields.get()route might be the way to do it, but I am second guessing myself now...
What's the point to the Mach-O section __swift5_typeref? I totally understand the
__swift5_types, which I'd say equates to Objective-C's
__DATA.__objc_classlist, but I don't get the purpose to
__swift5_typeref, which seems like it's already taken care of by
__swift5_types. I know there's more data packed into a
__swift5_typerefindex (6 bytes on 64bit) vs __swift5_types 4 bytes, but can't deduce the use of those extra 2 bytes.
Thank you. Sorry again for the question count. Y'all are awesome