Skip to content

Commit 6df72d6

Browse files
committed
Runtime: Move GenericContextDescriptorFlags and GenericPackKind to MetadataValues.h
1 parent 814488f commit 6df72d6

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

include/swift/ABI/GenericContext.h

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -30,38 +30,6 @@ struct TargetProtocolConformanceDescriptor;
3030
template <typename Runtime>
3131
struct TargetGenericContext;
3232

33-
class GenericContextDescriptorFlags {
34-
uint16_t Value;
35-
36-
public:
37-
constexpr GenericContextDescriptorFlags() : Value(0) {}
38-
39-
explicit constexpr GenericContextDescriptorFlags(uint16_t value)
40-
: Value(value) {}
41-
42-
constexpr GenericContextDescriptorFlags(bool hasTypePacks)
43-
: GenericContextDescriptorFlags(
44-
GenericContextDescriptorFlags((uint16_t)0)
45-
.withHasTypePacks(hasTypePacks)) {}
46-
47-
/// Whether this generic context has at least one type parameter
48-
/// pack, in which case the generic context will have a trailing
49-
/// GenericPackShapeHeader.
50-
constexpr bool hasTypePacks() const {
51-
return (Value & 0x1) != 0;
52-
}
53-
54-
constexpr GenericContextDescriptorFlags
55-
withHasTypePacks(bool hasTypePacks) const {
56-
return GenericContextDescriptorFlags((uint16_t)(
57-
(Value & ~0x1) | (hasTypePacks ? 0x1 : 0)));
58-
}
59-
60-
constexpr uint16_t getIntValue() const {
61-
return Value;
62-
}
63-
};
64-
6533
template <typename Runtime>
6634
struct TargetGenericContextDescriptorHeader {
6735
/// The number of (source-written) generic parameters, and thus
@@ -260,11 +228,6 @@ struct GenericPackShapeHeader {
260228
uint16_t NumShapeClasses;
261229
};
262230

263-
enum class GenericPackKind: uint16_t {
264-
Metadata = 0,
265-
WitnessTable = 1
266-
};
267-
268231
/// The GenericPackShapeHeader is followed by an array of these descriptors,
269232
/// whose length is given by the header's NumPacks field.
270233
///

include/swift/ABI/MetadataValues.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,6 +1812,38 @@ class AnonymousContextDescriptorFlags : public FlagSet<uint16_t> {
18121812
setHasMangledName)
18131813
};
18141814

1815+
class GenericContextDescriptorFlags {
1816+
uint16_t Value;
1817+
1818+
public:
1819+
constexpr GenericContextDescriptorFlags() : Value(0) {}
1820+
1821+
explicit constexpr GenericContextDescriptorFlags(uint16_t value)
1822+
: Value(value) {}
1823+
1824+
constexpr GenericContextDescriptorFlags(bool hasTypePacks)
1825+
: GenericContextDescriptorFlags(
1826+
GenericContextDescriptorFlags((uint16_t)0)
1827+
.withHasTypePacks(hasTypePacks)) {}
1828+
1829+
/// Whether this generic context has at least one type parameter
1830+
/// pack, in which case the generic context will have a trailing
1831+
/// GenericPackShapeHeader.
1832+
constexpr bool hasTypePacks() const {
1833+
return (Value & 0x1) != 0;
1834+
}
1835+
1836+
constexpr GenericContextDescriptorFlags
1837+
withHasTypePacks(bool hasTypePacks) const {
1838+
return GenericContextDescriptorFlags((uint16_t)(
1839+
(Value & ~0x1) | (hasTypePacks ? 0x1 : 0)));
1840+
}
1841+
1842+
constexpr uint16_t getIntValue() const {
1843+
return Value;
1844+
}
1845+
};
1846+
18151847
enum class GenericParamKind : uint8_t {
18161848
/// A type parameter.
18171849
Type = 0,
@@ -1989,6 +2021,11 @@ enum class GenericRequirementLayoutKind : uint32_t {
19892021
Class = 0,
19902022
};
19912023

2024+
enum class GenericPackKind : uint16_t {
2025+
Metadata = 0,
2026+
WitnessTable = 1
2027+
};
2028+
19922029
class GenericEnvironmentFlags {
19932030
uint32_t Value;
19942031

0 commit comments

Comments
 (0)