Skip to content

Commit a25118d

Browse files
committed
Runtime: Add HasResilientSuperclass flag
1 parent d6bbf81 commit a25118d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

include/swift/ABI/MetadataValues.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ enum class ProtocolDispatchStrategy: uint8_t {
315315
class GenericParameterDescriptorFlags {
316316
typedef uint16_t int_type;
317317
enum : int_type {
318-
HasVTable = 0x0004,
318+
HasVTable = 0x0004,
319+
HasResilientSuperclass = 0x0008,
319320
};
320321
int_type Data;
321322

@@ -335,6 +336,23 @@ class GenericParameterDescriptorFlags {
335336
return Data & HasVTable;
336337
}
337338

339+
constexpr GenericParameterDescriptorFlags withHasResilientSuperclass(bool b) const {
340+
return GenericParameterDescriptorFlags(b ? (Data | HasResilientSuperclass)
341+
: (Data & ~HasResilientSuperclass));
342+
}
343+
344+
/// If this type is a class, does it have a resilient superclass?
345+
/// If so, the generic parameter offset, field offset vector offset
346+
/// and vtable start offsets are relative to the start of the class's
347+
/// immediate members in the metadata, and not the start of the
348+
/// metadata itself.
349+
///
350+
/// Note that the immediate members begin at the same offset where the
351+
/// superclass metadata ends.
352+
bool hasResilientSuperclass() const {
353+
return Data & HasResilientSuperclass;
354+
}
355+
338356
int_type getIntValue() const {
339357
return Data;
340358
}

0 commit comments

Comments
 (0)