@@ -2199,10 +2199,9 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
2199
2199
/// specialization, which is expected to be able to hold at least 1024
2200
2200
/// according to [implimits]. However, as this limit is somewhat easy to
2201
2201
/// 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;
2206
2205
};
2207
2206
2208
2207
class DependentTemplateSpecializationTypeBitfields {
@@ -2821,6 +2820,18 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
2821
2820
/// immediately following this class.
2822
2821
template <typename T> const T *getAs() const;
2823
2822
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
+
2824
2835
/// Member-template getAsAdjusted<specific type>. Look through specific kinds
2825
2836
/// of sugar (parens, attributes, etc) for an instance of \<specific type>.
2826
2837
/// This is used when you need to walk over sugar nodes that represent some
@@ -6594,7 +6605,7 @@ class AutoType : public DeducedType {
6594
6605
static void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
6595
6606
QualType Deduced, AutoTypeKeyword Keyword,
6596
6607
bool IsDependent, ConceptDecl *CD,
6597
- ArrayRef<TemplateArgument> Arguments);
6608
+ ArrayRef<TemplateArgument> Arguments, bool Canonical );
6598
6609
6599
6610
static bool classof(const Type *T) {
6600
6611
return T->getTypeClass() == Auto;
@@ -6672,10 +6683,10 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
6672
6683
/// replacement must, recursively, be one of these).
6673
6684
TemplateName Template;
6674
6685
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 );
6679
6690
6680
6691
public:
6681
6692
/// Determine whether any of the given template arguments are dependent.
@@ -6728,11 +6739,13 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
6728
6739
/// Retrieve the name of the template that we are specializing.
6729
6740
TemplateName getTemplateName() const { return Template; }
6730
6741
6731
- ArrayRef<TemplateArgument> template_arguments () const {
6742
+ ArrayRef<TemplateArgument> getSpecifiedArguments () const {
6732
6743
return {reinterpret_cast<const TemplateArgument *>(this + 1),
6733
- TemplateSpecializationTypeBits.NumArgs };
6744
+ TemplateSpecializationTypeBits.NumSpecifiedArgs };
6734
6745
}
6735
6746
6747
+ ArrayRef<TemplateArgument> getConvertedArguments() const;
6748
+
6736
6749
bool isSugared() const {
6737
6750
return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
6738
6751
}
@@ -6743,8 +6756,10 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
6743
6756
6744
6757
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx);
6745
6758
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);
6748
6763
6749
6764
static bool classof(const Type *T) {
6750
6765
return T->getTypeClass() == TemplateSpecialization;
@@ -7099,13 +7114,14 @@ class DependentTemplateSpecializationType : public TypeWithKeyword,
7099
7114
QualType desugar() const { return QualType(this, 0); }
7100
7115
7101
7116
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());
7103
7119
}
7104
7120
7105
7121
static void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
7106
7122
ElaboratedTypeKeyword Keyword,
7107
7123
const DependentTemplateStorage &Name,
7108
- ArrayRef<TemplateArgument> Args);
7124
+ ArrayRef<TemplateArgument> Args, bool IsCanonical );
7109
7125
7110
7126
static bool classof(const Type *T) {
7111
7127
return T->getTypeClass() == DependentTemplateSpecialization;
0 commit comments