mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Runtime: Tolerate unknown metadata kinds.
We want to be able to potentially introduce new metadata kinds in future Swift compilers, so a runtime ought to be able to degrade gracefully in the face of metadata kinds it doesn't know about. Remove attempts to exhaustively switch over metadata kinds and instead treat unknown metadata kinds as opaque.
This commit is contained in:
@@ -54,9 +54,20 @@ enum class MetadataKind : uint32_t {
|
||||
#define ABSTRACTMETADATAKIND(name, start, end) \
|
||||
name##_Start = start, name##_End = end,
|
||||
#include "MetadataKind.def"
|
||||
|
||||
/// The largest possible non-isa-pointer metadata kind value.
|
||||
///
|
||||
/// This is included in the enumeration to prevent against attempts to
|
||||
/// exhaustively match metadata kinds. Future Swift runtimes or compilers
|
||||
/// may introduce new metadata kinds, so for forward compatibility, the
|
||||
/// runtime must tolerate metadata with unknown kinds.
|
||||
/// This specific value is not mapped to a valid metadata kind at this time,
|
||||
/// however.
|
||||
LastEnumerated = 2047,
|
||||
};
|
||||
|
||||
const unsigned LastEnumeratedMetadataKind = 2047;
|
||||
const unsigned LastEnumeratedMetadataKind =
|
||||
(unsigned)MetadataKind::LastEnumerated;
|
||||
|
||||
/// Try to translate the 'isa' value of a type/heap metadata into a value
|
||||
/// of the MetadataKind enum.
|
||||
|
||||
Reference in New Issue
Block a user