@@ -3763,13 +3763,6 @@ class SubstitutableType : public TypeBase {
3763
3763
: TypeBase (K, C, properties) { }
3764
3764
3765
3765
public:
3766
- // / \brief Retrieve the name of this type.
3767
- Identifier getName () const ;
3768
-
3769
- // / \brief Retrieve the parent of this type, or null if this is a
3770
- // / primary type.
3771
- SubstitutableType *getParent () const ;
3772
-
3773
3766
// Implement isa/cast/dyncast/etc.
3774
3767
static bool classof (const TypeBase *T) {
3775
3768
return T->getKind () >= TypeKind::First_SubstitutableType &&
@@ -4033,29 +4026,10 @@ CanArchetypeType getParent() const {
4033
4026
}
4034
4027
END_CAN_TYPE_WRAPPER (ArchetypeType, SubstitutableType)
4035
4028
4036
- // / Abstract class used to describe the type of a generic type parameter
4037
- // / or associated type.
4038
- // /
4039
- // / \sa AbstractTypeParamDecl
4040
- class AbstractTypeParamType : public SubstitutableType {
4041
- protected:
4042
- AbstractTypeParamType (TypeKind kind, const ASTContext *ctx,
4043
- RecursiveTypeProperties properties)
4044
- : SubstitutableType (kind, ctx, properties) { }
4045
-
4046
- public:
4047
- // Implement isa/cast/dyncast/etc.
4048
- static bool classof (const TypeBase *T) {
4049
- return T->getKind () >= TypeKind::First_AbstractTypeParamType &&
4050
- T->getKind () <= TypeKind::Last_AbstractTypeParamType;
4051
- }
4052
- };
4053
- DEFINE_EMPTY_CAN_TYPE_WRAPPER (AbstractTypeParamType, SubstitutableType)
4054
-
4055
4029
// / Describes the type of a generic parameter.
4056
4030
// /
4057
4031
// / \sa GenericTypeParamDecl
4058
- class GenericTypeParamType : public AbstractTypeParamType {
4032
+ class GenericTypeParamType : public SubstitutableType {
4059
4033
using DepthIndexTy = llvm::PointerEmbeddedInt<unsigned , 31 >;
4060
4034
4061
4035
// / The generic type parameter or depth/index.
@@ -4108,28 +4082,28 @@ class GenericTypeParamType : public AbstractTypeParamType {
4108
4082
friend class GenericTypeParamDecl ;
4109
4083
4110
4084
explicit GenericTypeParamType (GenericTypeParamDecl *param)
4111
- : AbstractTypeParamType (TypeKind::GenericTypeParam, nullptr ,
4112
- RecursiveTypeProperties::HasTypeParameter),
4085
+ : SubstitutableType (TypeKind::GenericTypeParam, nullptr ,
4086
+ RecursiveTypeProperties::HasTypeParameter),
4113
4087
ParamOrDepthIndex (param) { }
4114
4088
4115
4089
explicit GenericTypeParamType (unsigned depth,
4116
4090
unsigned index,
4117
4091
const ASTContext &ctx)
4118
- : AbstractTypeParamType (TypeKind::GenericTypeParam, &ctx,
4119
- RecursiveTypeProperties::HasTypeParameter),
4092
+ : SubstitutableType (TypeKind::GenericTypeParam, &ctx,
4093
+ RecursiveTypeProperties::HasTypeParameter),
4120
4094
ParamOrDepthIndex (depth << 16 | index) { }
4121
4095
};
4122
- BEGIN_CAN_TYPE_WRAPPER (GenericTypeParamType, AbstractTypeParamType )
4096
+ BEGIN_CAN_TYPE_WRAPPER (GenericTypeParamType, SubstitutableType )
4123
4097
static CanGenericTypeParamType get(unsigned depth, unsigned index,
4124
4098
const ASTContext &C) {
4125
4099
return CanGenericTypeParamType (GenericTypeParamType::get (depth, index, C));
4126
4100
}
4127
- END_CAN_TYPE_WRAPPER (GenericTypeParamType, AbstractTypeParamType )
4101
+ END_CAN_TYPE_WRAPPER (GenericTypeParamType, SubstitutableType )
4128
4102
4129
4103
// / Describes the type of an associated type.
4130
4104
// /
4131
4105
// / \sa AssociatedTypeDecl
4132
- class AssociatedTypeType : public AbstractTypeParamType {
4106
+ class AssociatedTypeType : public TypeBase {
4133
4107
// / The generic type parameter.
4134
4108
AssociatedTypeDecl *AssocType;
4135
4109
@@ -4151,11 +4125,10 @@ class AssociatedTypeType : public AbstractTypeParamType {
4151
4125
// These aren't classified as dependent for some reason.
4152
4126
4153
4127
AssociatedTypeType (AssociatedTypeDecl *assocType)
4154
- : AbstractTypeParamType (TypeKind::AssociatedType, nullptr ,
4155
- RecursiveTypeProperties ()),
4128
+ : TypeBase (TypeKind::AssociatedType, nullptr , RecursiveTypeProperties ()),
4156
4129
AssocType (assocType) { }
4157
4130
};
4158
- DEFINE_EMPTY_CAN_TYPE_WRAPPER (AssociatedTypeType, AbstractTypeParamType )
4131
+ DEFINE_EMPTY_CAN_TYPE_WRAPPER (AssociatedTypeType, Type )
4159
4132
4160
4133
// / SubstitutedType - A type that has been substituted for some other type,
4161
4134
// / which implies that the replacement type meets all of the requirements of
@@ -4669,22 +4642,6 @@ ParameterTypeFlags::fromParameterType(Type paramTy, bool isVariadic) {
4669
4642
return {isVariadic, autoclosure, escaping};
4670
4643
}
4671
4644
4672
- inline Identifier SubstitutableType::getName () const {
4673
- if (auto Archetype = dyn_cast<ArchetypeType>(this ))
4674
- return Archetype->getName ();
4675
- if (auto GenericParam = dyn_cast<GenericTypeParamType>(this ))
4676
- return GenericParam->getName ();
4677
-
4678
- llvm_unreachable (" Not a substitutable type" );
4679
- }
4680
-
4681
- inline SubstitutableType *SubstitutableType::getParent () const {
4682
- if (auto Archetype = dyn_cast<ArchetypeType>(this ))
4683
- return Archetype->getParent ();
4684
-
4685
- return nullptr ;
4686
- }
4687
-
4688
4645
inline CanType Type::getCanonicalTypeOrNull () const {
4689
4646
return isNull () ? CanType () : getPointer ()->getCanonicalType ();
4690
4647
}
0 commit comments