@@ -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+
18151847enum class GenericParamKind : uint8_t {
18161848 // / A type parameter.
18171849 Type = 0 ,
@@ -1823,28 +1855,23 @@ enum class GenericParamKind : uint8_t {
18231855};
18241856
18251857class GenericParamDescriptor {
1858+ // / Don't set 0x40 for compatibility with pre-Swift 5.8 runtimes
18261859 uint8_t Value;
18271860
18281861 explicit constexpr GenericParamDescriptor (uint8_t Value)
18291862 : Value(Value) {}
18301863public:
18311864 constexpr GenericParamDescriptor (GenericParamKind kind,
1832- bool hasKeyArgument,
1833- bool hasExtraArgument)
1865+ bool hasKeyArgument)
18341866 : GenericParamDescriptor(GenericParamDescriptor(0 )
18351867 .withKind(kind)
1836- .withKeyArgument(hasKeyArgument)
1837- .withExtraArgument(hasExtraArgument))
1868+ .withKeyArgument(hasKeyArgument))
18381869 {}
18391870
18401871 constexpr bool hasKeyArgument () const {
18411872 return (Value & 0x80u ) != 0 ;
18421873 }
18431874
1844- constexpr bool hasExtraArgument () const {
1845- return (Value & 0x40u ) != 0 ;
1846- }
1847-
18481875 constexpr GenericParamKind getKind () const {
18491876 return GenericParamKind (Value & 0x3Fu );
18501877 }
@@ -1855,12 +1882,6 @@ class GenericParamDescriptor {
18551882 | (hasKeyArgument ? 0x80u : 0 ));
18561883 }
18571884
1858- constexpr GenericParamDescriptor
1859- withExtraArgument (bool hasExtraArgument) const {
1860- return GenericParamDescriptor ((Value & 0xBFu )
1861- | (hasExtraArgument ? 0x40u : 0 ));
1862- }
1863-
18641885 constexpr GenericParamDescriptor withKind (GenericParamKind kind) const {
18651886 return assert ((uint8_t (kind) & 0x3Fu ) == uint8_t (kind)),
18661887 GenericParamDescriptor ((Value & 0xC0u ) | uint8_t (kind));
@@ -1882,8 +1903,7 @@ class GenericParamDescriptor {
18821903 // / The default parameter descriptor for an implicit parameter.
18831904 static constexpr GenericParamDescriptor implicit () {
18841905 return GenericParamDescriptor (GenericParamKind::Type,
1885- /* key argument*/ true ,
1886- /* extra argument*/ false );
1906+ /* key argument*/ true );
18871907 }
18881908};
18891909
@@ -1920,30 +1940,25 @@ enum class GenericRequirementKind : uint8_t {
19201940};
19211941
19221942class GenericRequirementFlags {
1943+ // / Don't set 0x40 for compatibility with pre-Swift 5.8 runtimes
19231944 uint32_t Value;
19241945
19251946 explicit constexpr GenericRequirementFlags (uint32_t Value)
19261947 : Value(Value) {}
19271948public:
19281949 constexpr GenericRequirementFlags (GenericRequirementKind kind,
19291950 bool hasKeyArgument,
1930- bool hasExtraArgument,
19311951 bool isPackRequirement)
19321952 : GenericRequirementFlags(GenericRequirementFlags(0 )
19331953 .withKind(kind)
19341954 .withKeyArgument(hasKeyArgument)
1935- .withExtraArgument(hasExtraArgument)
19361955 .withPackRequirement(isPackRequirement))
19371956 {}
19381957
19391958 constexpr bool hasKeyArgument () const {
19401959 return (Value & 0x80u ) != 0 ;
19411960 }
19421961
1943- constexpr bool hasExtraArgument () const {
1944- return (Value & 0x40u ) != 0 ;
1945- }
1946-
19471962 // / If this is true, the subject type of the requirement is a pack.
19481963 // / When the requirement is a conformance requirement, the corresponding
19491964 // / entry in the generic arguments array becomes a TargetWitnessTablePack.
@@ -1961,12 +1976,6 @@ class GenericRequirementFlags {
19611976 | (hasKeyArgument ? 0x80u : 0 ));
19621977 }
19631978
1964- constexpr GenericRequirementFlags
1965- withExtraArgument (bool hasExtraArgument) const {
1966- return GenericRequirementFlags ((Value & 0xBFu )
1967- | (hasExtraArgument ? 0x40u : 0 ));
1968- }
1969-
19701979 constexpr GenericRequirementFlags
19711980 withPackRequirement (bool isPackRequirement) const {
19721981 return GenericRequirementFlags ((Value & 0xBFu )
@@ -1989,6 +1998,11 @@ enum class GenericRequirementLayoutKind : uint32_t {
19891998 Class = 0 ,
19901999};
19912000
2001+ enum class GenericPackKind : uint16_t {
2002+ Metadata = 0 ,
2003+ WitnessTable = 1
2004+ };
2005+
19922006class GenericEnvironmentFlags {
19932007 uint32_t Value;
19942008
0 commit comments