Skip to content

Commit 11e3d16

Browse files
authored
Merge pull request #14998 from rjmccall/generic-metadata-patterns
Apply generic metadata patterns to all types and change their layout.
2 parents 18e0a5c + dff0031 commit 11e3d16

27 files changed

+818
-413
lines changed

include/swift/ABI/MetadataValues.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,47 @@ enum class GenericRequirementLayoutKind : uint32_t {
11771177
Class = 0,
11781178
};
11791179

1180+
/// Flags used by generic metadata patterns.
1181+
class GenericMetadataPatternFlags : public FlagSet<uint32_t> {
1182+
enum {
1183+
// All of these values are bit offsets or widths.
1184+
// General flags build up from 0.
1185+
// Kind-specific flags build down from 31.
1186+
1187+
/// Does this pattern have an extra-data pattern?
1188+
HasExtraDataPattern = 0,
1189+
1190+
// Class-specific flags.
1191+
1192+
/// Does this pattern have an immediate-members pattern?
1193+
Class_HasImmediateMembersPattern = 31,
1194+
1195+
// Value-specific flags.
1196+
1197+
/// For value metadata: the metadata kind of the type.
1198+
Value_MetadataKind = 21,
1199+
Value_MetadataKind_width = 11,
1200+
};
1201+
1202+
public:
1203+
explicit GenericMetadataPatternFlags(uint32_t bits) : FlagSet(bits) {}
1204+
constexpr GenericMetadataPatternFlags() {}
1205+
1206+
FLAGSET_DEFINE_FLAG_ACCESSORS(Class_HasImmediateMembersPattern,
1207+
class_hasImmediateMembersPattern,
1208+
class_setHasImmediateMembersPattern)
1209+
1210+
FLAGSET_DEFINE_FLAG_ACCESSORS(HasExtraDataPattern,
1211+
hasExtraDataPattern,
1212+
setHasExtraDataPattern)
1213+
1214+
FLAGSET_DEFINE_FIELD_ACCESSORS(Value_MetadataKind,
1215+
Value_MetadataKind_width,
1216+
MetadataKind,
1217+
value_getMetadataKind,
1218+
value_setMetadataKind)
1219+
};
1220+
11801221
} // end namespace swift
11811222

11821223
#endif /* SWIFT_ABI_METADATAVALUES_H */

0 commit comments

Comments
 (0)