@@ -2208,10 +2208,9 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
22082208 // / specialization, which is expected to be able to hold at least 1024
22092209 // / according to [implimits]. However, as this limit is somewhat easy to
22102210 // / hit with template metaprogramming we'd prefer to keep it as large
2211- // / as possible. At the moment it has been left as a non-bitfield since
2212- // / this type safely fits in 64 bits as an unsigned, so there is no reason
2213- // / to introduce the performance impact of a bitfield.
2214- unsigned NumArgs;
2211+ // / as possible.
2212+ unsigned NumSpecifiedArgs : 16 ;
2213+ unsigned NumConvertedArgs : 16 ;
22152214 };
22162215
22172216 class DependentTemplateSpecializationTypeBitfields {
@@ -2830,6 +2829,18 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
28302829 // / immediately following this class.
28312830 template <typename T> const T *getAs () const ;
28322831
2832+ // / Look through sugar for an instance of TemplateSpecializationType which
2833+ // / is not a type alias.
2834+ const TemplateSpecializationType *
2835+ getAsNonAliasTemplateSpecializationType () const ;
2836+
2837+ const TemplateSpecializationType *
2838+ castAsNonAliasTemplateSpecializationType () const {
2839+ auto TST = getAsNonAliasTemplateSpecializationType ();
2840+ assert (TST && " not a TemplateSpecializationType" );
2841+ return TST;
2842+ }
2843+
28332844 // / Member-template getAsAdjusted<specific type>. Look through specific kinds
28342845 // / of sugar (parens, attributes, etc) for an instance of \<specific type>.
28352846 // / This is used when you need to walk over sugar nodes that represent some
@@ -6601,7 +6612,7 @@ class AutoType : public DeducedType {
66016612 static void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Context,
66026613 QualType Deduced, AutoTypeKeyword Keyword,
66036614 bool IsDependent, ConceptDecl *CD,
6604- ArrayRef<TemplateArgument> Arguments);
6615+ ArrayRef<TemplateArgument> Arguments, bool Canonical );
66056616
66066617 static bool classof (const Type *T) {
66076618 return T->getTypeClass () == Auto;
@@ -6679,10 +6690,10 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
66796690 // / replacement must, recursively, be one of these).
66806691 TemplateName Template;
66816692
6682- TemplateSpecializationType (TemplateName T,
6683- ArrayRef<TemplateArgument> Args ,
6684- QualType Canon ,
6685- QualType Aliased );
6693+ TemplateSpecializationType (TemplateName T, bool IsAlias,
6694+ ArrayRef<TemplateArgument> SpecifiedArgs ,
6695+ ArrayRef<TemplateArgument> ConvertedArgs ,
6696+ QualType Underlying );
66866697
66876698public:
66886699 // / Determine whether any of the given template arguments are dependent.
@@ -6735,11 +6746,13 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
67356746 // / Retrieve the name of the template that we are specializing.
67366747 TemplateName getTemplateName () const { return Template; }
67376748
6738- ArrayRef<TemplateArgument> template_arguments () const {
6749+ ArrayRef<TemplateArgument> getSpecifiedArguments () const {
67396750 return {reinterpret_cast <const TemplateArgument *>(this + 1 ),
6740- TemplateSpecializationTypeBits.NumArgs };
6751+ TemplateSpecializationTypeBits.NumSpecifiedArgs };
67416752 }
67426753
6754+ ArrayRef<TemplateArgument> getConvertedArguments () const ;
6755+
67436756 bool isSugared () const {
67446757 return !isDependentType () || isCurrentInstantiation () || isTypeAlias ();
67456758 }
@@ -6750,8 +6763,10 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
67506763
67516764 void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Ctx);
67526765 static void Profile (llvm::FoldingSetNodeID &ID, TemplateName T,
6753- ArrayRef<TemplateArgument> Args,
6754- const ASTContext &Context);
6766+ ArrayRef<TemplateArgument> SpecifiedArgs,
6767+ ArrayRef<TemplateArgument> ConvertedArgs,
6768+ QualType Underlying, const ASTContext &Context,
6769+ bool Canonical);
67556770
67566771 static bool classof (const Type *T) {
67576772 return T->getTypeClass () == TemplateSpecialization;
@@ -7110,15 +7125,15 @@ class DependentTemplateSpecializationType : public TypeWithKeyword,
71107125 QualType desugar () const { return QualType (this , 0 ); }
71117126
71127127 void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Context) {
7113- Profile (ID, Context, getKeyword (), NNS, Name, template_arguments ());
7128+ Profile (ID, Context, getKeyword (), NNS, Name, template_arguments (),
7129+ isCanonicalUnqualified ());
71147130 }
71157131
7116- static void Profile (llvm::FoldingSetNodeID &ID,
7117- const ASTContext &Context,
7132+ static void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Context,
71187133 ElaboratedTypeKeyword Keyword,
71197134 NestedNameSpecifier *Qualifier,
71207135 const IdentifierInfo *Name,
7121- ArrayRef<TemplateArgument> Args);
7136+ ArrayRef<TemplateArgument> Args, bool Canonical );
71227137
71237138 static bool classof (const Type *T) {
71247139 return T->getTypeClass () == DependentTemplateSpecialization;
0 commit comments