diff options
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 16cf114..3a16111 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -80,6 +80,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Frontend/OpenMP/OMPIRBuilder.h" #include "llvm/Support/Capacity.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MD5.h" @@ -717,13 +718,13 @@ comments::FullComment *ASTContext::getCommentForDecl( return FC; } -void -ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &ID, - const ASTContext &C, - TemplateTemplateParmDecl *Parm) { +void ASTContext::CanonicalTemplateTemplateParm::Profile( + llvm::FoldingSetNodeID &ID, const ASTContext &C, + TemplateTemplateParmDecl *Parm) { ID.AddInteger(Parm->getDepth()); ID.AddInteger(Parm->getPosition()); ID.AddBoolean(Parm->isParameterPack()); + ID.AddInteger(Parm->templateParameterKind()); TemplateParameterList *Params = Parm->getTemplateParameters(); ID.AddInteger(Params->size()); @@ -829,7 +830,9 @@ ASTContext::getCanonicalTemplateTemplateParmDecl( TemplateTemplateParmDecl *CanonTTP = TemplateTemplateParmDecl::Create( *this, getTranslationUnitDecl(), SourceLocation(), TTP->getDepth(), - TTP->getPosition(), TTP->isParameterPack(), nullptr, /*Typename=*/false, + TTP->getPosition(), TTP->isParameterPack(), nullptr, + TTP->templateParameterKind(), + /*Typename=*/false, TemplateParameterList::Create(*this, SourceLocation(), SourceLocation(), CanonParams, SourceLocation(), /*RequiresClause=*/nullptr)); @@ -6643,7 +6646,7 @@ ASTContext::getUnaryTransformType(QualType BaseType, QualType UnderlyingType, QualType ASTContext::getAutoTypeInternal( QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, - bool IsPack, ConceptDecl *TypeConstraintConcept, + bool IsPack, TemplateDecl *TypeConstraintConcept, ArrayRef<TemplateArgument> TypeConstraintArgs, bool IsCanon) const { if (DeducedType.isNull() && Keyword == AutoTypeKeyword::Auto && !TypeConstraintConcept && !IsDependent) @@ -6652,7 +6655,8 @@ QualType ASTContext::getAutoTypeInternal( // Look in the folding set for an existing type. llvm::FoldingSetNodeID ID; bool IsDeducedDependent = - !DeducedType.isNull() && DeducedType->isDependentType(); + isa_and_nonnull<TemplateTemplateParmDecl>(TypeConstraintConcept) || + (!DeducedType.isNull() && DeducedType->isDependentType()); AutoType::Profile(ID, *this, DeducedType, Keyword, IsDependent || IsDeducedDependent, TypeConstraintConcept, TypeConstraintArgs); @@ -6665,7 +6669,8 @@ QualType ASTContext::getAutoTypeInternal( Canon = DeducedType.getCanonicalType(); } else if (TypeConstraintConcept) { bool AnyNonCanonArgs = false; - ConceptDecl *CanonicalConcept = TypeConstraintConcept->getCanonicalDecl(); + auto *CanonicalConcept = + cast<TemplateDecl>(TypeConstraintConcept->getCanonicalDecl()); auto CanonicalConceptArgs = ::getCanonicalTemplateArguments( *this, TypeConstraintArgs, AnyNonCanonArgs); if (CanonicalConcept != TypeConstraintConcept || AnyNonCanonArgs) { @@ -6701,7 +6706,7 @@ QualType ASTContext::getAutoTypeInternal( QualType ASTContext::getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack, - ConceptDecl *TypeConstraintConcept, + TemplateDecl *TypeConstraintConcept, ArrayRef<TemplateArgument> TypeConstraintArgs) const { assert((!IsPack || IsDependent) && "only use IsPack for a dependent pack"); assert((!IsDependent || DeducedType.isNull()) && @@ -14387,8 +14392,8 @@ static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X, if (KW != AY->getKeyword()) return QualType(); - ConceptDecl *CD = ::getCommonDecl(AX->getTypeConstraintConcept(), - AY->getTypeConstraintConcept()); + TemplateDecl *CD = ::getCommonDecl(AX->getTypeConstraintConcept(), + AY->getTypeConstraintConcept()); SmallVector<TemplateArgument, 8> As; if (CD && getCommonTemplateArguments(Ctx, As, AX->getTypeConstraintArguments(), |