@@ -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
@@ -6595,7 +6606,7 @@ class AutoType : public DeducedType {
65956606 static void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Context,
65966607 QualType Deduced, AutoTypeKeyword Keyword,
65976608 bool IsDependent, ConceptDecl *CD,
6598- ArrayRef<TemplateArgument> Arguments);
6609+ ArrayRef<TemplateArgument> Arguments, bool Canonical );
65996610
66006611 static bool classof (const Type *T) {
66016612 return T->getTypeClass () == Auto;
@@ -6673,10 +6684,10 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
66736684 // / replacement must, recursively, be one of these).
66746685 TemplateName Template;
66756686
6676- TemplateSpecializationType (TemplateName T,
6677- ArrayRef<TemplateArgument> Args ,
6678- QualType Canon ,
6679- QualType Aliased );
6687+ TemplateSpecializationType (TemplateName T, bool IsAlias,
6688+ ArrayRef<TemplateArgument> SpecifiedArgs ,
6689+ ArrayRef<TemplateArgument> ConvertedArgs ,
6690+ QualType Underlying );
66806691
66816692public:
66826693 // / Determine whether any of the given template arguments are dependent.
@@ -6729,11 +6740,13 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
67296740 // / Retrieve the name of the template that we are specializing.
67306741 TemplateName getTemplateName () const { return Template; }
67316742
6732- ArrayRef<TemplateArgument> template_arguments () const {
6743+ ArrayRef<TemplateArgument> getSpecifiedArguments () const {
67336744 return {reinterpret_cast <const TemplateArgument *>(this + 1 ),
6734- TemplateSpecializationTypeBits.NumArgs };
6745+ TemplateSpecializationTypeBits.NumSpecifiedArgs };
67356746 }
67366747
6748+ ArrayRef<TemplateArgument> getConvertedArguments () const ;
6749+
67376750 bool isSugared () const {
67386751 return !isDependentType () || isCurrentInstantiation () || isTypeAlias ();
67396752 }
@@ -6744,8 +6757,10 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
67446757
67456758 void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Ctx);
67466759 static void Profile (llvm::FoldingSetNodeID &ID, TemplateName T,
6747- ArrayRef<TemplateArgument> Args,
6748- const ASTContext &Context);
6760+ ArrayRef<TemplateArgument> SpecifiedArgs,
6761+ ArrayRef<TemplateArgument> ConvertedArgs,
6762+ QualType Underlying, const ASTContext &Context,
6763+ bool Canonical);
67496764
67506765 static bool classof (const Type *T) {
67516766 return T->getTypeClass () == TemplateSpecialization;
@@ -7100,13 +7115,14 @@ class DependentTemplateSpecializationType : public TypeWithKeyword,
71007115 QualType desugar () const { return QualType (this , 0 ); }
71017116
71027117 void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Context) {
7103- Profile (ID, Context, getKeyword (), Name, template_arguments ());
7118+ Profile (ID, Context, getKeyword (), Name, template_arguments (),
7119+ isCanonicalUnqualified ());
71047120 }
71057121
71067122 static void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Context,
71077123 ElaboratedTypeKeyword Keyword,
71087124 const DependentTemplateStorage &Name,
7109- ArrayRef<TemplateArgument> Args);
7125+ ArrayRef<TemplateArgument> Args, bool IsCanonical );
71107126
71117127 static bool classof (const Type *T) {
71127128 return T->getTypeClass () == DependentTemplateSpecialization;
0 commit comments