@@ -2199,10 +2199,9 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
21992199 // / specialization, which is expected to be able to hold at least 1024
22002200 // / according to [implimits]. However, as this limit is somewhat easy to
22012201 // / hit with template metaprogramming we'd prefer to keep it as large
2202- // / as possible. At the moment it has been left as a non-bitfield since
2203- // / this type safely fits in 64 bits as an unsigned, so there is no reason
2204- // / to introduce the performance impact of a bitfield.
2205- unsigned NumArgs;
2202+ // / as possible.
2203+ unsigned NumSpecifiedArgs : 16 ;
2204+ unsigned NumConvertedArgs : 16 ;
22062205 };
22072206
22082207 class DependentTemplateSpecializationTypeBitfields {
@@ -2821,6 +2820,18 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
28212820 // / immediately following this class.
28222821 template <typename T> const T *getAs () const ;
28232822
2823+ // / Look through sugar for an instance of TemplateSpecializationType which
2824+ // / is not a type alias.
2825+ const TemplateSpecializationType *
2826+ getAsNonAliasTemplateSpecializationType () const ;
2827+
2828+ const TemplateSpecializationType *
2829+ castAsNonAliasTemplateSpecializationType () const {
2830+ auto TST = getAsNonAliasTemplateSpecializationType ();
2831+ assert (TST && " not a TemplateSpecializationType" );
2832+ return TST;
2833+ }
2834+
28242835 // / Member-template getAsAdjusted<specific type>. Look through specific kinds
28252836 // / of sugar (parens, attributes, etc) for an instance of \<specific type>.
28262837 // / This is used when you need to walk over sugar nodes that represent some
@@ -6594,7 +6605,7 @@ class AutoType : public DeducedType {
65946605 static void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Context,
65956606 QualType Deduced, AutoTypeKeyword Keyword,
65966607 bool IsDependent, ConceptDecl *CD,
6597- ArrayRef<TemplateArgument> Arguments);
6608+ ArrayRef<TemplateArgument> Arguments, bool Canonical );
65986609
65996610 static bool classof (const Type *T) {
66006611 return T->getTypeClass () == Auto;
@@ -6672,10 +6683,10 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
66726683 // / replacement must, recursively, be one of these).
66736684 TemplateName Template;
66746685
6675- TemplateSpecializationType (TemplateName T,
6676- ArrayRef<TemplateArgument> Args ,
6677- QualType Canon ,
6678- QualType Aliased );
6686+ TemplateSpecializationType (TemplateName T, bool IsAlias,
6687+ ArrayRef<TemplateArgument> SpecifiedArgs ,
6688+ ArrayRef<TemplateArgument> ConvertedArgs ,
6689+ QualType Underlying );
66796690
66806691public:
66816692 // / Determine whether any of the given template arguments are dependent.
@@ -6728,11 +6739,13 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
67286739 // / Retrieve the name of the template that we are specializing.
67296740 TemplateName getTemplateName () const { return Template; }
67306741
6731- ArrayRef<TemplateArgument> template_arguments () const {
6742+ ArrayRef<TemplateArgument> getSpecifiedArguments () const {
67326743 return {reinterpret_cast <const TemplateArgument *>(this + 1 ),
6733- TemplateSpecializationTypeBits.NumArgs };
6744+ TemplateSpecializationTypeBits.NumSpecifiedArgs };
67346745 }
67356746
6747+ ArrayRef<TemplateArgument> getConvertedArguments () const ;
6748+
67366749 bool isSugared () const {
67376750 return !isDependentType () || isCurrentInstantiation () || isTypeAlias ();
67386751 }
@@ -6743,8 +6756,10 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
67436756
67446757 void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Ctx);
67456758 static void Profile (llvm::FoldingSetNodeID &ID, TemplateName T,
6746- ArrayRef<TemplateArgument> Args,
6747- const ASTContext &Context);
6759+ ArrayRef<TemplateArgument> SpecifiedArgs,
6760+ ArrayRef<TemplateArgument> ConvertedArgs,
6761+ QualType Underlying, const ASTContext &Context,
6762+ bool Canonical);
67486763
67496764 static bool classof (const Type *T) {
67506765 return T->getTypeClass () == TemplateSpecialization;
@@ -7099,13 +7114,14 @@ class DependentTemplateSpecializationType : public TypeWithKeyword,
70997114 QualType desugar () const { return QualType (this , 0 ); }
71007115
71017116 void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Context) {
7102- Profile (ID, Context, getKeyword (), Name, template_arguments ());
7117+ Profile (ID, Context, getKeyword (), Name, template_arguments (),
7118+ isCanonicalUnqualified ());
71037119 }
71047120
71057121 static void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Context,
71067122 ElaboratedTypeKeyword Keyword,
71077123 const DependentTemplateStorage &Name,
7108- ArrayRef<TemplateArgument> Args);
7124+ ArrayRef<TemplateArgument> Args, bool IsCanonical );
71097125
71107126 static bool classof (const Type *T) {
71117127 return T->getTypeClass () == DependentTemplateSpecialization;
0 commit comments