mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Runtime: Generalize TypeMetadataRecords to non-type contexts.
We could introduce non-nominal-type context descriptors, such as those for opaque declarations, which are also interesting to be able to look up for reflection or remote purposes. This should be a backward compatible change with old runtimes, which always ignore any context descriptor kind they don't know about.
This commit is contained in:
@@ -457,6 +457,7 @@ template <typename Runtime> struct TargetStructMetadata;
|
||||
template <typename Runtime> struct TargetOpaqueMetadata;
|
||||
template <typename Runtime> struct TargetValueMetadata;
|
||||
template <typename Runtime> struct TargetForeignClassMetadata;
|
||||
template <typename Runtime> struct TargetContextDescriptor;
|
||||
template <typename Runtime> class TargetTypeContextDescriptor;
|
||||
template <typename Runtime> class TargetClassDescriptor;
|
||||
template <typename Runtime> class TargetValueTypeDescriptor;
|
||||
@@ -2085,12 +2086,12 @@ struct TargetTypeMetadataRecord {
|
||||
private:
|
||||
union {
|
||||
/// A direct reference to a nominal type descriptor.
|
||||
RelativeDirectPointerIntPair<TargetTypeContextDescriptor<Runtime>,
|
||||
RelativeDirectPointerIntPair<TargetContextDescriptor<Runtime>,
|
||||
TypeReferenceKind>
|
||||
DirectNominalTypeDescriptor;
|
||||
|
||||
/// An indirect reference to a nominal type descriptor.
|
||||
RelativeDirectPointerIntPair<TargetTypeContextDescriptor<Runtime> * const,
|
||||
RelativeDirectPointerIntPair<TargetContextDescriptor<Runtime> * const,
|
||||
TypeReferenceKind>
|
||||
IndirectNominalTypeDescriptor;
|
||||
|
||||
@@ -2103,8 +2104,8 @@ public:
|
||||
return DirectNominalTypeDescriptor.getInt();
|
||||
}
|
||||
|
||||
const TargetTypeContextDescriptor<Runtime> *
|
||||
getTypeContextDescriptor() const {
|
||||
const TargetContextDescriptor<Runtime> *
|
||||
getContextDescriptor() const {
|
||||
switch (getTypeKind()) {
|
||||
case TypeReferenceKind::DirectTypeDescriptor:
|
||||
return DirectNominalTypeDescriptor.getPointer();
|
||||
|
||||
Reference in New Issue
Block a user