diff --git a/clang/include/clang/AST/ASTConcept.h b/clang/include/clang/AST/ASTConcept.h index ace4de0d627726..ef560886924b3a 100644 --- a/clang/include/clang/AST/ASTConcept.h +++ b/clang/include/clang/AST/ASTConcept.h @@ -281,54 +281,6 @@ class TypeConstraint { }; -class PartiallyAppliedConcept : public ConceptReference, - public llvm::FoldingSetNode { - - SourceLocation ConceptKWLoc; - PartiallyAppliedConcept(NestedNameSpecifierLoc NNS, - DeclarationNameInfo ConceptNameInfo, - SourceLocation ConceptKWLoc, NamedDecl *FoundDecl, - TemplateDecl *NamedConcept, - const ASTTemplateArgumentListInfo *ArgsAsWritten) - : ConceptReference(NNS, /*TemplateKWLoc=*/SourceLocation(), - ConceptNameInfo, FoundDecl, NamedConcept, - ArgsAsWritten), - ConceptKWLoc(ConceptKWLoc) {} - -public: - static PartiallyAppliedConcept * - Create(const ASTContext &C, NestedNameSpecifierLoc NNS, - DeclarationNameInfo ConceptNameInfo, SourceLocation ConceptKWLoc, - NamedDecl *FoundDecl, TemplateDecl *NamedConcept, - const TemplateArgumentListInfo &TemplateArgs); - - TemplateArgumentDependence getDependence() const; - - bool isDependent() const { - return getDependence() & TemplateArgumentDependence::Dependent; - } - - bool isInstantiationDependent() const { - return getDependence() & TemplateArgumentDependence::Instantiation; - } - - void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C) const { - Profile(ID, C, getNamedConcept(), getTemplateArgsAsWritten()); - } - - static void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C, - const TemplateDecl *NamedConcept, - const ASTTemplateArgumentListInfo *ArgsAsWritten); - - SourceLocation getConceptKWLoc() const { return ConceptKWLoc; } - - SourceRange getSourceRange() const { - return {ConceptKWLoc, ArgsAsWritten->getRAngleLoc()}; - } - - friend const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, - PartiallyAppliedConcept &C); -}; } // clang diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 272a712fe170c4..ae6430cb932e1b 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -97,7 +97,6 @@ class ObjCTypeParamDecl; class OMPTraitInfo; class ParentMapContext; struct ParsedTargetAttr; -class PartiallyAppliedConcept; class Preprocessor; class ProfileList; class StoredDeclsMap; diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index c0dd6783336627..1e15f5e372f0ce 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -904,14 +904,6 @@ bool RecursiveASTVisitor::TraverseTemplateArgument( case TemplateArgument::Pack: return getDerived().TraverseTemplateArguments(Arg.pack_elements()); - case TemplateArgument::Concept: { - PartiallyAppliedConcept *C = Arg.getAsPartiallyAppliedConcept(); - TRY_TO(getDerived().TraverseDecl(C->getNamedConcept())); - for (const TemplateArgumentLoc &Arg : - C->getTemplateArgsAsWritten()->arguments()) - TRY_TO(TraverseTemplateArgument(Arg.getArgument())); - return true; - } case TemplateArgument::Universal: case TemplateArgument::UniversalExpansion: { UniversalTemplateParameterName *UTPN = @@ -965,14 +957,6 @@ bool RecursiveASTVisitor::TraverseTemplateArgumentLoc( case TemplateArgument::Pack: return getDerived().TraverseTemplateArguments(Arg.pack_elements()); - case TemplateArgument::Concept: { - PartiallyAppliedConcept *C = Arg.getAsPartiallyAppliedConcept(); - TRY_TO(getDerived().TraverseDecl(C->getNamedConcept())); - for (const TemplateArgumentLoc &Arg : - C->getTemplateArgsAsWritten()->arguments()) - TRY_TO(TraverseTemplateArgument(Arg.getArgument())); - return true; - } } return true; diff --git a/clang/include/clang/AST/TemplateArgumentVisitor.h b/clang/include/clang/AST/TemplateArgumentVisitor.h index 2e6d3cf9daf0e9..91b7ed1b389dc5 100644 --- a/clang/include/clang/AST/TemplateArgumentVisitor.h +++ b/clang/include/clang/AST/TemplateArgumentVisitor.h @@ -42,7 +42,6 @@ class Base { DISPATCH(TemplateExpansion); DISPATCH(Expression); DISPATCH(Pack); - DISPATCH(Concept); DISPATCH(Universal); DISPATCH(UniversalExpansion); } @@ -68,7 +67,6 @@ class Base { VISIT_METHOD(TemplateExpansion); VISIT_METHOD(Expression); VISIT_METHOD(Pack); - VISIT_METHOD(Concept); VISIT_METHOD(Universal); VISIT_METHOD(UniversalExpansion); diff --git a/clang/include/clang/AST/TemplateBase.h b/clang/include/clang/AST/TemplateBase.h index f4aded4957fe05..03d3cfb5f586aa 100644 --- a/clang/include/clang/AST/TemplateBase.h +++ b/clang/include/clang/AST/TemplateBase.h @@ -58,7 +58,6 @@ class Expr; struct PrintingPolicy; class TypeSourceInfo; class ValueDecl; -class PartiallyAppliedConcept; /// Represents a template argument. class TemplateArgument { @@ -109,9 +108,6 @@ class TemplateArgument { /// in the Args struct. Pack, - // A concept with argument - Concept, - /// The template argument refers to a universal template parameter Universal, @@ -183,12 +179,6 @@ class TemplateArgument { uintptr_t V; }; - struct ConceptData { - unsigned Kind : 31; - unsigned IsDefaulted : 1; - PartiallyAppliedConcept *C; - }; - struct UniversalTpl { unsigned Kind : 31; unsigned IsDefaulted : 1; @@ -203,7 +193,6 @@ class TemplateArgument { struct A Args; struct TA TemplateArg; struct TV TypeOrValue; - struct ConceptData PartialConcept; struct UniversalTpl UniversalArg; }; @@ -311,13 +300,6 @@ class TemplateArgument { this->Args.NumArgs = Args.size(); } - explicit TemplateArgument(PartiallyAppliedConcept *C, - bool IsDefaulted = false) { - PartialConcept.Kind = Concept; - PartialConcept.IsDefaulted = IsDefaulted; - PartialConcept.C = C; - } - explicit TemplateArgument(UniversalTemplateParameterName *U, bool IsDefaulted = false) { UniversalArg.Kind = Universal; @@ -411,11 +393,6 @@ class TemplateArgument { return TemplateName::getFromVoidPointer(TemplateArg.Name); } - PartiallyAppliedConcept *getAsPartiallyAppliedConcept() const { - assert((getKind() == Concept) && "Unexpected kind"); - return PartialConcept.C; - } - UniversalTemplateParameterName *getAsUniversalTemplateParameterName() const { assert((getKind() == Universal) && "Unexpected kind"); return UniversalArg.D; @@ -647,8 +624,7 @@ class TemplateArgumentLoc { : Argument(Argument), LocInfo(Ctx, QualifierLoc, TemplateNameLoc, EllipsisLoc) { assert(Argument.getKind() == TemplateArgument::Template || - Argument.getKind() == TemplateArgument::TemplateExpansion || - Argument.getKind() == TemplateArgument::Concept); + Argument.getKind() == TemplateArgument::TemplateExpansion); } TemplateArgumentLoc(ASTContext &Ctx, const TemplateArgument &Argument, @@ -662,8 +638,7 @@ class TemplateArgumentLoc { /// - Fetches the primary location of the argument. SourceLocation getLocation() const { if (Argument.getKind() == TemplateArgument::Template || - Argument.getKind() == TemplateArgument::TemplateExpansion || - Argument.getKind() == TemplateArgument::Concept) + Argument.getKind() == TemplateArgument::TemplateExpansion) return getTemplateNameLoc(); return getSourceRange().getBegin(); @@ -709,16 +684,14 @@ class TemplateArgumentLoc { NestedNameSpecifierLoc getTemplateQualifierLoc() const { if (Argument.getKind() != TemplateArgument::Template && - Argument.getKind() != TemplateArgument::TemplateExpansion && - Argument.getKind() != TemplateArgument::Concept) + Argument.getKind() != TemplateArgument::TemplateExpansion) return NestedNameSpecifierLoc(); return LocInfo.getTemplateQualifierLoc(); } SourceLocation getTemplateNameLoc() const { if (Argument.getKind() != TemplateArgument::Template && - Argument.getKind() != TemplateArgument::TemplateExpansion && - Argument.getKind() != TemplateArgument::Concept) + Argument.getKind() != TemplateArgument::TemplateExpansion) return SourceLocation(); return LocInfo.getTemplateNameLoc(); } diff --git a/clang/include/clang/AST/TypeProperties.td b/clang/include/clang/AST/TypeProperties.td index 74d69045aa2f55..1a89dfc67bc9b4 100644 --- a/clang/include/clang/AST/TypeProperties.td +++ b/clang/include/clang/AST/TypeProperties.td @@ -508,7 +508,7 @@ let Class = AutoType in { } def : Property<"typeConstraintConcept", Optional> { let Read = [{ makeOptionalFromPointer( - const_cast(node->getTypeConstraintConcept())) }]; + node->getTypeConstraintConcept()) }]; } def : Property<"typeConstraintArguments", Array> { let Read = [{ node->getTypeConstraintArguments() }]; diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index 4bc36c30d94ea1..9bd4376b5005c8 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -3865,7 +3865,6 @@ class Parser : public CodeCompletionHandler { bool IsClassName = false); bool ParseTemplateArgumentList(TemplateArgList &TemplateArgs, TemplateTy Template, SourceLocation OpenLoc); - ParsedTemplateArgument ParsePartiallyAppliedConceptTemplateArgument(); ParsedTemplateArgument ParseTemplateTemplateArgument(); ParsedTemplateArgument ParseUniversalTemplateParamNameArgument(); ParsedTemplateArgument ParseTemplateArgument(); diff --git a/clang/include/clang/Sema/ParsedTemplate.h b/clang/include/clang/Sema/ParsedTemplate.h index 80cd101b3db1d2..c9046561c73547 100644 --- a/clang/include/clang/Sema/ParsedTemplate.h +++ b/clang/include/clang/Sema/ParsedTemplate.h @@ -26,7 +26,6 @@ #include namespace clang { -class PartiallyAppliedConcept; /// Represents the parsed form of a C++ template argument. class ParsedTemplateArgument { @@ -39,8 +38,6 @@ class ParsedTemplateArgument { NonType, /// A template template argument, stored as a template name. Template, - /// A partially applied concept - PartiallyAppliedConcept, /// The name of a Universal Template Parameter Universal }; @@ -71,11 +68,6 @@ class ParsedTemplateArgument { : Kind(ParsedTemplateArgument::Template), Arg(Template.getAsOpaquePtr()), SS(SS), Loc(TemplateLoc) {} - ParsedTemplateArgument(class PartiallyAppliedConcept *Concept, - SourceLocation TemplateLoc) - : Kind(ParsedTemplateArgument::PartiallyAppliedConcept), Arg(Concept), - Loc(TemplateLoc) {} - ParsedTemplateArgument(UniversalTemplateParamNameTy ParamName, SourceLocation Loc) : Kind(ParsedTemplateArgument::Universal), @@ -105,11 +97,6 @@ class ParsedTemplateArgument { return ParsedTemplateTy::getFromOpaquePtr(Arg); } - class PartiallyAppliedConcept *getAsConcept() const { - assert(Kind == PartiallyAppliedConcept && "Not a concept argument"); - return reinterpret_cast(Arg); - } - UniversalTemplateParamNameTy getAsUniversalTemplateParamName() const { assert(Kind == Universal && "Not a reference to a universal template parameter"); @@ -122,7 +109,7 @@ class ParsedTemplateArgument { /// Retrieve the nested-name-specifier that precedes the template /// name in a template template argument. const CXXScopeSpec &getScopeSpec() const { - assert((Kind == Template || Kind == PartiallyAppliedConcept) && + assert((Kind == Template) && "Only template template arguments can have a scope specifier"); return SS; } diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 15910e424ad619..615f2eeb916c70 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -974,7 +974,6 @@ class Sema final : public SemaBase { typedef OpaquePtr DeclGroupPtrTy; typedef OpaquePtr TemplateTy; - typedef OpaquePtr ConceptTy; typedef OpaquePtr UniversalTemplateParamNameTy; typedef OpaquePtr TypeTy; @@ -11537,15 +11536,6 @@ class Sema final : public SemaBase { bool EnteringContext, TemplateTy &Template, bool AllowInjectedClassName = false); - PartiallyAppliedConcept *BuildPartiallyAppliedConcept( - NestedNameSpecifierLoc NNS, SourceLocation ConceptKWLoc, - DeclarationNameInfo ConceptName, TemplateDecl *TD, - const TemplateArgumentListInfo &TemplateArgs); - PartiallyAppliedConcept * - ActOnPartiallyAppliedConcept(Scope *S, CXXScopeSpec &SS, - SourceLocation ConceptKWLoc, - TemplateIdAnnotation *TemplateId); - bool ActOnUniversalTemplateParameterName(Scope *S, const UnqualifiedId &Name, bool EnteringContext, @@ -11836,10 +11826,6 @@ class Sema final : public SemaBase { TemplateArgument &SugaredConverted, TemplateArgument &CanonicalConverted, CheckTemplateArgumentKind CTAK); - bool - CheckPartiallyAppliedConceptTemplateArgument(TemplateTemplateParmDecl *Param, - TemplateParameterList *Params, - TemplateArgumentLoc &Arg); /// Check a template argument against its corresponding /// template template parameter. diff --git a/clang/lib/AST/ASTConcept.cpp b/clang/lib/AST/ASTConcept.cpp index f787a2cec7eb6f..518bf0d7b6a889 100644 --- a/clang/lib/AST/ASTConcept.cpp +++ b/clang/lib/AST/ASTConcept.cpp @@ -113,55 +113,3 @@ void ConceptReference::print(llvm::raw_ostream &OS, OS << ">"; } } - - -PartiallyAppliedConcept *PartiallyAppliedConcept::Create( - const ASTContext &C, NestedNameSpecifierLoc NNS, - DeclarationNameInfo ConceptNameInfo, SourceLocation ConceptKWLoc, - NamedDecl *FoundDecl, TemplateDecl *NamedConcept, - const TemplateArgumentListInfo &TemplateArgs) { - - return new (C) PartiallyAppliedConcept( - NNS, ConceptNameInfo, ConceptKWLoc, FoundDecl, NamedConcept, - ASTTemplateArgumentListInfo::Create(C, TemplateArgs)); -} - -TemplateArgumentDependence PartiallyAppliedConcept::getDependence() const { - auto TA = TemplateArgumentDependence::None; - if (isa(getNamedConcept())) { - TA |= TemplateArgumentDependence::DependentInstantiation; - } - const auto InterestingDeps = TemplateArgumentDependence::Instantiation | - TemplateArgumentDependence::UnexpandedPack; - for (const TemplateArgumentLoc &ArgLoc : - getTemplateArgsAsWritten()->arguments()) { - TA |= ArgLoc.getArgument().getDependence() & InterestingDeps; - if (TA == InterestingDeps) - break; - } - return TA; -} - -void PartiallyAppliedConcept::Profile( - llvm::FoldingSetNodeID &ID, const ASTContext &C, - const TemplateDecl *NamedConcept, - const ASTTemplateArgumentListInfo *ArgsAsWritten) { - ID.AddPointer(NamedConcept); - ID.AddInteger(ArgsAsWritten->getNumTemplateArgs()); - for (auto &Arg : ArgsAsWritten->arguments()) - Arg.getArgument().Profile(ID, C); -} - -const StreamingDiagnostic &clang::operator<<(const StreamingDiagnostic &DB, - PartiallyAppliedConcept &C) { - std::string NameStr; - llvm::raw_string_ostream OS(NameStr); - LangOptions LO; - LO.CPlusPlus = true; - LO.Bool = true; - OS << '\''; - C.print(OS, PrintingPolicy(LO)); - OS << '\''; - OS.flush(); - return DB << NameStr; -} diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index ca47d719deac62..56e8ac1db31265 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -7308,10 +7308,6 @@ ASTContext::getCanonicalTemplateArgument(const TemplateArgument &Arg) const { case TemplateArgument::Expression: return Arg; - // FIXME corentin: do concept needs to be canonicalized? - case TemplateArgument::Concept: - return Arg; - case TemplateArgument::Declaration: { auto *D = cast(Arg.getAsDecl()->getCanonicalDecl()); return TemplateArgument(D, getCanonicalType(Arg.getParamTypeForDecl()), diff --git a/clang/lib/AST/ASTStructuralEquivalence.cpp b/clang/lib/AST/ASTStructuralEquivalence.cpp index e50c0e64997691..1f314c44c81933 100644 --- a/clang/lib/AST/ASTStructuralEquivalence.cpp +++ b/clang/lib/AST/ASTStructuralEquivalence.cpp @@ -661,17 +661,6 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, ArrayRef Args1, ArrayRef Args2); -static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, - const PartiallyAppliedConcept *C1, - const PartiallyAppliedConcept *C2) { - if (!IsStructurallyEquivalent(Context, C1->getNamedConcept(), - C2->getNamedConcept())) - return false; - return IsStructurallyEquivalent(Context, - C1->getTemplateArgsAsWritten()->arguments(), - C2->getTemplateArgsAsWritten()->arguments()); -} - /// Determine whether two template arguments are equivalent. static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, const TemplateArgument &Arg1, @@ -704,11 +693,6 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, return IsStructurallyEquivalent(Context, Arg1.getAsTemplate(), Arg2.getAsTemplate()); - case TemplateArgument::Concept: - return IsStructurallyEquivalent(Context, - Arg1.getAsPartiallyAppliedConcept(), - Arg2.getAsPartiallyAppliedConcept()); - case TemplateArgument::TemplateExpansion: return IsStructurallyEquivalent(Context, Arg1.getAsTemplateOrTemplatePattern(), diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 0173f030c2f48e..cad047b6ed54af 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -360,13 +360,6 @@ LinkageComputer::getLVForTemplateArgumentList(ArrayRef Args, LV.merge(getLVForDecl(Template, computation)); continue; - // FIXME corentin - case TemplateArgument::Concept: - if (TemplateDecl *Template = - Arg.getAsPartiallyAppliedConcept()->getNamedConcept()) - LV.merge(getLVForDecl(Template, computation)); - continue; - case TemplateArgument::Pack: LV.merge(getLVForTemplateArgumentList(Arg.getPackAsArray(), computation)); continue; diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index fbf76fcf9e80de..1a77f19d57cba9 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -90,7 +90,7 @@ TemplateParameterList::TemplateParameterList(const ASTContext& C, if (TTP->hasTypeConstraint()) HasConstrainedParameters = true; } else { - llvm_unreachable("unexpected template parameter type"); + // llvm_unreachable("unexpected template parameter type"); } } @@ -248,7 +248,7 @@ getAssociatedConstraints(llvm::SmallVectorImpl &AC) const { AC.push_back(E); } } - if (HasRequiresClause) + if (HasRequiresClause && getRequiresClause()) AC.push_back(getRequiresClause()); } @@ -878,7 +878,7 @@ TemplateTemplateParmDecl * TemplateTemplateParmDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { return new (C, ID) TemplateTemplateParmDecl(nullptr, SourceLocation(), 0, 0, nullptr, - TemplateNameKind::TNK_Type_template, false, nullptr, std::nullopt); + TemplateNameKind::TNK_Type_template, false, nullptr, nullptr); } TemplateTemplateParmDecl * diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index dc50ab6f1d286c..3f9a775f9da0b2 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/lib/AST/ExprCXX.cpp @@ -1767,7 +1767,7 @@ QualType SubstNonTypeTemplateParmExpr::getParameterType( // T', so we can't just compute this from the type and value category. QualType Type = getType(); - if (isa(getParameter())) + if (isa(getAssociatedDecl())) Type = getReplacement()->getType(); if (isReferenceParameter()) @@ -1974,9 +1974,10 @@ CXXFoldExpr::CXXFoldExpr(QualType T, UnresolvedLookupExpr *Callee, EllipsisLoc(EllipsisLoc), RParenLoc(RParenLoc), NumExpansions(NumExpansions ? *NumExpansions + 1 : 0), Opcode(Opcode) { // We rely on asserted invariant to distinguish left and right folds. - assert(((LHS && LHS->containsUnexpandedParameterPack()) != - (RHS && RHS->containsUnexpandedParameterPack())) && - "Exactly one of LHS or RHS should contain an unexpanded pack"); + if(LHS && RHS) + assert(LHS->containsUnexpandedParameterPack() != + RHS->containsUnexpandedParameterPack() && + "Exactly one of LHS or RHS should contain an unexpanded pack"); SubExprs[SubExpr::Callee] = Callee; SubExprs[SubExpr::LHS] = LHS; SubExprs[SubExpr::RHS] = RHS; diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index 1ce962f47aeb7d..ad4281986f668e 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -2455,15 +2455,6 @@ void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) { VisitTemplateName(Arg.getAsTemplateOrTemplatePattern()); break; - case TemplateArgument::Concept: { - PartiallyAppliedConcept* C = Arg.getAsPartiallyAppliedConcept(); - VisitDecl(C->getNamedConcept()); - for (const auto &P : C->getTemplateArgsAsWritten()->arguments()) { - VisitTemplateArgument(P.getArgument()); - } - break; - } - case TemplateArgument::Declaration: VisitType(Arg.getParamTypeForDecl()); // FIXME: Do we need to recursively decompose template parameter objects? diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp index d753cf4a5d7a1c..b4bbbb719f09f0 100644 --- a/clang/lib/AST/TemplateBase.cpp +++ b/clang/lib/AST/TemplateBase.cpp @@ -308,10 +308,6 @@ TemplateArgumentDependence TemplateArgument::getDependence() const { TemplateArgumentDependence::Instantiation; return Deps; - case Concept: { - Deps = getAsPartiallyAppliedConcept()->getDependence(); - return Deps; - } case Pack: for (const auto &P : pack_elements()) Deps |= P.getDependence(); @@ -337,7 +333,6 @@ bool TemplateArgument::isPackExpansion() const { case Pack: case Template: case NullPtr: - case Concept: case Universal: return false; @@ -356,8 +351,8 @@ bool TemplateArgument::isPackExpansion() const { } bool TemplateArgument::isConceptOrConceptTemplateParameter() const { - bool isConcept = getKind() == TemplateArgument::Concept; - if (!isConcept && getKind() == TemplateArgument::Template) { + bool isConcept = false; + if (getKind() == TemplateArgument::Template) { if (isa(getAsTemplate().getAsTemplateDecl())) isConcept = true; else if (auto *TTP = dyn_cast_if_present( @@ -389,7 +384,6 @@ QualType TemplateArgument::getNonTypeTemplateArgumentType() const { case TemplateArgument::Template: case TemplateArgument::TemplateExpansion: case TemplateArgument::Pack: - case TemplateArgument::Concept: case TemplateArgument::Universal: case TemplateArgument::UniversalExpansion: return QualType(); @@ -440,10 +434,6 @@ void TemplateArgument::Profile(llvm::FoldingSetNodeID &ID, ID.AddPointer(TemplateArg.Name); break; - case Concept: - getAsPartiallyAppliedConcept()->Profile(ID, Context); - break; - case UniversalExpansion: ID.AddInteger(UniversalArg.NumExpansions); [[fallthrough]]; @@ -492,22 +482,6 @@ bool TemplateArgument::structurallyEquals(const TemplateArgument &Other) const { return UniversalArg.D == Other.UniversalArg.D && UniversalArg.NumExpansions == Other.UniversalArg.NumExpansions; - case Concept: { - PartiallyAppliedConcept *C = getAsPartiallyAppliedConcept(); - PartiallyAppliedConcept *OC = Other.getAsPartiallyAppliedConcept(); - if (C->getNamedConcept() != OC->getNamedConcept()) - return false; - const ASTTemplateArgumentListInfo *Args = C->getTemplateArgsAsWritten(); - const ASTTemplateArgumentListInfo *OArgs = OC->getTemplateArgsAsWritten(); - if (Args->getNumTemplateArgs() != OArgs->getNumTemplateArgs()) - return false; - for (unsigned I = 0; I < Args->getNumTemplateArgs(); I++) - if (!Args->arguments()[I].getArgument().structurallyEquals( - OArgs->arguments()[I].getArgument())) - return false; - return true; - } - case Declaration: return getAsDecl() == Other.getAsDecl() && getParamTypeForDecl() == Other.getParamTypeForDecl(); @@ -560,7 +534,6 @@ TemplateArgument TemplateArgument::getPackExpansionPattern() const { case Pack: case Null: case Template: - case Concept: case Universal: case NullPtr: return TemplateArgument(); @@ -629,10 +602,6 @@ void TemplateArgument::print(const PrintingPolicy &Policy, raw_ostream &Out, Out << "..."; break; - case Concept: - getAsPartiallyAppliedConcept()->print(Out, Policy); - break; - case Integral: printIntegral(*this, Out, Policy, IncludeType); break; @@ -692,10 +661,6 @@ SourceRange TemplateArgumentLoc::getSourceRange() const { getArgument().getAsUniversalTemplateParameterOrPattern()->getLocation(), getUniversalEllipsisLoc()); - // Fixme ? - case TemplateArgument::Concept: - return getArgument().getAsPartiallyAppliedConcept()->getSourceRange(); - case TemplateArgument::TemplateExpansion: if (getTemplateQualifierLoc()) return SourceRange(getTemplateQualifierLoc().getBeginLoc(), @@ -754,9 +719,6 @@ static const T &DiagTemplateArg(const T &DB, const TemplateArgument &Arg) { case TemplateArgument::TemplateExpansion: return DB << Arg.getAsTemplateOrTemplatePattern() << "..."; - case TemplateArgument::Concept: - return DB << *Arg.getAsPartiallyAppliedConcept(); - case TemplateArgument::Universal: return DB << *Arg.getAsUniversalTemplateParameterName(); diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp index c1bd94a34e28db..ea592be2a4b1b9 100644 --- a/clang/lib/AST/TextNodeDumper.cpp +++ b/clang/lib/AST/TextNodeDumper.cpp @@ -1237,11 +1237,6 @@ void TextNodeDumper::VisitTemplateExpansionTemplateArgument( dumpBareTemplateName(TA.getAsTemplateOrTemplatePattern()); } -void TextNodeDumper::VisitConceptTemplateArgument(const TemplateArgument &TA) { - OS << " concept "; - OS << TA.getAsPartiallyAppliedConcept()->getConceptNameInfo().getName(); -} - void TextNodeDumper::VisitUniversalTemplateArgument( const TemplateArgument &TA) { OS << " universal "; diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 8597304dbd3c88..305c0c53943870 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -5532,8 +5532,6 @@ bool CGDebugInfo::HasReconstitutableArgs( ArrayRef Args) const { return llvm::all_of(Args, [&](const TemplateArgument &TA) { switch (TA.getKind()) { - case TemplateArgument::Concept: - return false; case TemplateArgument::Template: // Easy to reconstitute - the value of the parameter in the debug // info is the string name of the template. The template name diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp index f38bef2e713aaa..e58ab5ede3b1ce 100644 --- a/clang/lib/Parse/ParseTemplate.cpp +++ b/clang/lib/Parse/ParseTemplate.cpp @@ -1551,30 +1551,6 @@ ParsedTemplateArgument Parser::ParseTemplateTemplateArgument() { return Result; } -/// partially-applied-concept: -/// concept id-dexpression < arguments > -ParsedTemplateArgument Parser::ParsePartiallyAppliedConceptTemplateArgument() { - if (Tok.isNot(tok::kw_concept)) - return {}; - SourceLocation ConceptLoc = ConsumeToken(); - CXXScopeSpec SS; // nested-name-specifier, if present - ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/nullptr, - /*ObjectHasErrors=*/false, - /*EnteringContext=*/false); - ParsedTemplateArgument Result; - if (Tok.is(tok::annot_template_id)) { - TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok); - ConsumeAnnotationToken(); - PartiallyAppliedConcept *C = Actions.ActOnPartiallyAppliedConcept( - getCurScope(), SS, ConceptLoc, TemplateId); - if (!C) - return {}; - Result = ParsedTemplateArgument(C, ConceptLoc); - return Result; - } - return {}; -} - ParsedTemplateArgument Parser::ParseUniversalTemplateParamNameArgument() { if (!Tok.isOneOf(tok::identifier, tok::annot_universal)) return ParsedTemplateArgument(); @@ -1661,13 +1637,6 @@ ParsedTemplateArgument Parser::ParseTemplateArgument() { TPA.Revert(); } - { - ParsedTemplateArgument Concept = - ParsePartiallyAppliedConceptTemplateArgument(); - if (!Concept.isInvalid()) - return Concept; - } - { TentativeParsingAction TPA(*this); // Parse a non-type template argument. diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index e08499bd0cc17e..0592020a87b88d 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -2950,7 +2950,6 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, break; } - case TemplateArgument::Concept: case clang::TemplateArgument::Universal: case clang::TemplateArgument::UniversalExpansion: case TemplateArgument::Declaration: diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 896cbf70018aee..799e92558659aa 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -941,14 +941,7 @@ static TemplateArgumentLoc translateTemplateArgument(Sema &SemaRef, Arg.getScopeSpec().getWithLocInContext(SemaRef.Context), Arg.getLocation(), Arg.getEllipsisLoc()); } - case clang::ParsedTemplateArgument::PartiallyAppliedConcept: { - PartiallyAppliedConcept *C = Arg.getAsConcept(); - TemplateArgument TArg(C); - return TemplateArgumentLoc( - SemaRef.Context, TArg, - Arg.getScopeSpec().getWithLocInContext(SemaRef.Context), - Arg.getLocation()); - } + case clang::ParsedTemplateArgument::Universal: { UniversalTemplateParamNameTy U = Arg.getAsUniversalTemplateParamName(); TemplateArgument TArg; @@ -1210,8 +1203,7 @@ static ExprResult formImmediatelyDeclaredConstraint( if (auto *CD = dyn_cast(NamedConcept)) { ImmediatelyDeclaredConstraint = S.CheckConceptTemplateId( SS, /*TemplateKWLoc=*/SourceLocation(), NameInfo, - // /*FoundDecl=*/FoundDecl ? FoundDecl : NamedConcept, - NamedConcept, + /*FoundDecl=*/FoundDecl ? FoundDecl : NamedConcept, CD, &ConstraintArgs); if (ImmediatelyDeclaredConstraint.isInvalid() || !EllipsisLoc.isValid()) return ImmediatelyDeclaredConstraint; @@ -4965,47 +4957,6 @@ TemplateNameKind Sema::ActOnTemplateName(Scope *S, return TNK_Non_template; } -PartiallyAppliedConcept *Sema::BuildPartiallyAppliedConcept( - NestedNameSpecifierLoc NNS, SourceLocation ConceptKWLoc, - DeclarationNameInfo ConceptName, TemplateDecl *TD, - const TemplateArgumentListInfo &TemplateArgs) { - - return PartiallyAppliedConcept::Create(getASTContext(), NNS, ConceptName, - ConceptKWLoc, TD, TD, TemplateArgs); -} - -PartiallyAppliedConcept * -Sema::ActOnPartiallyAppliedConcept(Scope *S, CXXScopeSpec &SS, - SourceLocation ConceptKWLoc, - TemplateIdAnnotation *TemplateId) { - - if (TemplateId->isInvalid()) - return nullptr; - TemplateName TN = TemplateId->Template.get(); - if (TN.isNull()) - return nullptr; - bool IsConcept = false; - TemplateDecl *TD = TN.getAsTemplateDecl(); - if(!TD) - return nullptr; - if (TemplateTemplateParmDecl *TTP = dyn_cast(TD)) - IsConcept = TTP->kind() == TNK_Concept_template; - else - IsConcept = isa(TD); - if (!IsConcept) { - Diag(TemplateId->TemplateNameLoc, diag::err_partial_concept_valid_template); - return nullptr; - } - - DeclarationNameInfo ConceptName(DeclarationName(TemplateId->Name), - TemplateId->TemplateNameLoc); - TemplateArgumentListInfo TemplateArgs = - makeTemplateArgumentListInfo(*this, *TemplateId); - NestedNameSpecifierLoc NNS = SS.getWithLocInContext(Context); - return BuildPartiallyAppliedConcept(NNS, ConceptKWLoc, ConceptName, TD, - TemplateArgs); -} - bool Sema::ActOnUniversalTemplateParameterName( Scope *S, const UnqualifiedId &Name, bool EnteringContext, UniversalTemplateParamNameTy &Template) { @@ -5232,7 +5183,6 @@ bool Sema::CheckUniversalTemplateParameterArgument( CanonicalConverted.push_back(CanonicalResult); break; } - case TemplateArgument::Concept: // TODO check invalid case TemplateArgument::Declaration: case TemplateArgument::Integral: @@ -5607,13 +5557,6 @@ bool Sema::CheckTemplateArgument( Context.getCanonicalTemplateArgument(Arg.getArgument())); break; - // TODO support non-type concepts - case TemplateArgument::Concept: - Diag(Arg.getLocation(), diag::err_template_arg_must_be_expr) - << Arg.getSourceRange(); - Diag(Param->getLocation(), diag::note_template_param_here); - return true; - case TemplateArgument::Universal: SugaredConverted.push_back(Arg.getArgument()); CanonicalConverted.push_back( @@ -5750,15 +5693,6 @@ bool Sema::CheckTemplateArgument( case TemplateArgument::Null: llvm_unreachable("Should never see a NULL template argument here"); - case TemplateArgument::Concept: - if (CheckPartiallyAppliedConceptTemplateArgument(TempParm, Params, Arg)) - return true; - - SugaredConverted.push_back(Arg.getArgument()); - CanonicalConverted.push_back( - Context.getCanonicalTemplateArgument(Arg.getArgument())); - break; - case TemplateArgument::Template: case TemplateArgument::TemplateExpansion: if (CheckTemplateTemplateArgument(TempParm, Params, Arg, @@ -7874,45 +7808,6 @@ void Sema::NoteTemplateParameterLocation(const NamedDecl &Decl) { diag::note_template_param_external); } -bool Sema::CheckPartiallyAppliedConceptTemplateArgument( - TemplateTemplateParmDecl *Param, TemplateParameterList *Params, - TemplateArgumentLoc &Arg) { - PartiallyAppliedConcept *C = Arg.getArgument().getAsPartiallyAppliedConcept(); - TemplateDecl *Template = C->getNamedConcept(); - if (Template->isInvalidDecl()) - return true; - - if (!CheckDeclCompatibleWithTemplateTemplate(Template, Param, Arg)) { - return true; - } - if (Params->size() != 1) { - Diag(C->getSourceRange().getBegin(), - diag::err_partial_concept_param_must_have_one_arg); - Diag(Param->getLocation(), - diag::note_concept_template_parameter_declared_here) - << Param; - return true; - } - unsigned MinArguments = - Template->getTemplateParameters()->getMinRequiredArguments(); - - auto Passed = C->getTemplateArgsAsWritten()->getNumTemplateArgs(); - bool TooFew = MinArguments > Passed + 1; - bool TooMany = Passed +1 > Template->getTemplateParameters()->size() && - !Template->getTemplateParameters()->hasParameterPack(); - - if (TooFew || TooMany) { - Diag(C->getSourceRange().getBegin(), - diag::err_template_arg_list_different_arity) - << (TooFew ? 0 : 1) << /*Concept*/ 5 << Template; - Diag(Template->getLocation(), diag::note_template_decl_here) - << Template->getTemplateParameters()->getSourceRange(); - return true; - } - - return false; -} - /// Given a non-type template argument that refers to a /// declaration and the type of its corresponding non-type template /// parameter, produce an expression that properly refers to that diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 5a93c3243089f7..eedeb09f71a9dd 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -1461,9 +1461,6 @@ namespace { /// this declaration. Decl *TransformDecl(SourceLocation Loc, Decl *D); - bool InjectAdditionalArgumentsFromPartiallyAppliedConcept( - TemplateArgumentListInfo &Args, TemplateDecl *D); - void transformAttrs(Decl *Old, Decl *New) { SemaRef.InstantiateAttrs(TemplateArgs, Old, New); } @@ -1866,10 +1863,6 @@ Decl *TemplateInstantiator::TransformDecl(SourceLocation Loc, Decl *D) { Arg = getPackSubstitutedTemplateArgument(getSema(), Arg); } - if (Arg.getKind() == clang::TemplateArgument::Concept) { - return Arg.getAsPartiallyAppliedConcept()->getNamedConcept(); - } - TemplateName Template = Arg.getAsTemplate(); assert(!Template.isNull() && Template.getAsTemplateDecl() && @@ -1889,23 +1882,6 @@ Decl *TemplateInstantiator::TransformDecl(SourceLocation Loc, Decl *D) { return SemaRef.FindInstantiatedDecl(Loc, cast(D), TemplateArgs); } -bool TemplateInstantiator::InjectAdditionalArgumentsFromPartiallyAppliedConcept( - TemplateArgumentListInfo &Args, TemplateDecl *D) { - auto [Depth, Index] = getDepthAndIndex(D); - if (Depth >= TemplateArgs.getNumLevels()) - return false; - if (!TemplateArgs.hasTemplateArgument(Depth, Index)) - return false; - TemplateArgument Arg = TemplateArgs(Depth, Index); - if (Arg.getKind() != clang::TemplateArgument::Concept) - return false; - PartiallyAppliedConcept *C = Arg.getAsPartiallyAppliedConcept(); - for (auto &Arg : C->getTemplateArgsAsWritten()->arguments()) { - Args.addArgument(Arg); - } - return true; -} - Decl *TemplateInstantiator::TransformDefinition(SourceLocation Loc, Decl *D) { Decl *Inst = getSema().SubstDecl(D, getSema().CurContext, TemplateArgs); if (!Inst) @@ -2113,38 +2089,6 @@ TemplateArgument TemplateInstantiator::TransformNamedTemplateTemplateArgument( return TemplateArgument(Name); TemplateArgument Arg = TemplateArgs(TTP->getDepth(), TTP->getPosition()); - if (Arg.getKind() == TemplateArgument::Concept) { - PartiallyAppliedConcept *C = Arg.getAsPartiallyAppliedConcept(); - TemplateDecl *T = cast_or_null(getDerived().TransformDecl( - C->getConceptNameLoc(), C->getNamedConcept())); - if (!T) - return TemplateArgument(); - - if (T == C->getNamedConcept() && !getDerived().AlwaysRebuild()) - return Arg; - - DeclarationNameInfo NameInfo = C->getConceptNameInfo(); - if (NameInfo.getName()) { - NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo); - if (!NameInfo.getName()) - return TemplateArgument(); - } - - TemplateArgumentListInfo NewTemplateArgs; - NewTemplateArgs.setLAngleLoc( - C->getTemplateArgsAsWritten()->getLAngleLoc()); - NewTemplateArgs.setLAngleLoc( - C->getTemplateArgsAsWritten()->getRAngleLoc()); - for (auto &Arg : C->getTemplateArgsAsWritten()->arguments()) - NewTemplateArgs.addArgument(Arg); - - PartiallyAppliedConcept *Transformed = - SemaRef.BuildPartiallyAppliedConcept(C->getNestedNameSpecifierLoc(), - C->getConceptKWLoc(), NameInfo, - T, NewTemplateArgs); - if (!Transformed) - return TemplateArgument(Transformed); - } } } TemplateName TN = getDerived().TransformTemplateName(SS, Name, NameLoc); @@ -2234,7 +2178,6 @@ NamedDecl *TemplateInstantiator::TransformUniversalTemplateParameter( case TemplateArgument::TemplateExpansion: case TemplateArgument::UniversalExpansion: case TemplateArgument::Pack: - case TemplateArgument::Concept: assert(false && "non implemented"); break; diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index d5b636423253b6..aee84e54c23e88 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -25,6 +25,7 @@ #include "clang/AST/Type.h" #include "clang/AST/TypeLoc.h" #include "clang/AST/TypeLocVisitor.h" +#include "clang/Basic/LLVM.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/PartialDiagnostic.h" #include "clang/Basic/SourceLocation.h" @@ -3062,13 +3063,12 @@ InventTemplateParameter(TypeProcessingState &state, QualType T, if (!Invalid) { UsingShadowDecl *USD = TemplateId->Template.get().getAsUsingShadowDecl(); - auto *CD = - cast(TemplateId->Template.get().getAsTemplateDecl()); + TemplateDecl *CD = TemplateId->Template.get().getAsTemplateDecl(); S.AttachTypeConstraint( D.getDeclSpec().getTypeSpecScope().getWithLocInContext(S.Context), DeclarationNameInfo(DeclarationName(TemplateId->Name), TemplateId->TemplateNameLoc), - cast(TemplateId->Template.get().getAsTemplateDecl()), + CD, /*FoundDecl=*/USD ? cast(USD) : CD, TemplateId->LAngleLoc.isValid() ? &TemplateArgsInfo : nullptr, InventedTemplateParam, D.getEllipsisLoc()); diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 174ebf067a6be5..3902996b227402 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -649,11 +649,6 @@ class TreeTransform { Uneval); } - bool InjectAdditionalArgumentsFromPartiallyAppliedConcept( - TemplateArgumentListInfo &, TemplateDecl *) { - return true; - } - /// Transform the given set of template arguments. /// /// By default, this operation transforms all of the template arguments @@ -4029,7 +4024,6 @@ class TreeTransform { case TemplateArgument::UniversalExpansion: case TemplateArgument::TemplateExpansion: case TemplateArgument::NullPtr: - case TemplateArgument::Concept: llvm_unreachable("Pack expansion pattern has no parameter packs"); case TemplateArgument::Type: @@ -4842,36 +4836,6 @@ bool TreeTransform::TransformTemplateArgument( return false; } - case TemplateArgument::Concept: { - PartiallyAppliedConcept *C = Arg.getAsPartiallyAppliedConcept(); - TemplateDecl *T = cast_or_null(getDerived().TransformDecl( - C->getConceptNameLoc(), C->getNamedConcept())); - if (!T) - return true; - DeclarationNameInfo NameInfo = C->getConceptNameInfo(); - if (NameInfo.getName()) { - NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo); - if (!NameInfo.getName()) - return true; - } - - TemplateArgumentListInfo NewTemplateArgs; - getDerived().TransformTemplateArguments( - C->getTemplateArgsAsWritten()->getTemplateArgs(), - C->getTemplateArgsAsWritten()->getNumTemplateArgs(), NewTemplateArgs); - - PartiallyAppliedConcept *Transformed = SemaRef.BuildPartiallyAppliedConcept( - C->getNestedNameSpecifierLoc(), C->getConceptKWLoc(), NameInfo, T, - NewTemplateArgs); - if (!Transformed) - return true; - - Output = TemplateArgumentLoc(SemaRef.Context, TemplateArgument(Transformed), - C->getNestedNameSpecifierLoc(), - NameInfo.getLoc(), SourceLocation()); - return false; - } - case TemplateArgument::Universal: { UniversalTemplateParameterName *N = Arg.getAsUniversalTemplateParameterName(); @@ -5103,8 +5067,8 @@ bool TreeTransform::TransformConceptTemplateArguments( bool Uneval) { auto isConcept = [](const TemplateArgument &Arg) { - bool isConcept = Arg.getKind() == TemplateArgument::Concept; - if (!isConcept && Arg.getKind() == TemplateArgument::Template) + bool isConcept = false; + if (Arg.getKind() == TemplateArgument::Template) if (auto *TTP = dyn_cast_if_present( Arg.getAsTemplate().getAsTemplateDecl())) isConcept = TTP->kind() == TNK_Concept_template; @@ -14065,12 +14029,6 @@ TreeTransform::TransformUnresolvedLookupExpr(UnresolvedLookupExpr *Old, R.clear(); return ExprError(); } - - if (Old->isConceptReference()) { - getDerived().InjectAdditionalArgumentsFromPartiallyAppliedConcept( - TransArgs, Old->getTemplateDecl()); - } - // An UnresolvedLookupExpr can refer to a class member. This occurs e.g. when // a non-static data member is named in an unevaluated operand, or when // a member is named in a dependent class scope function template explicit diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 9272e23c7da3fc..38dead8d9dba5d 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -2715,6 +2715,7 @@ void ASTDeclReader::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) { void ASTDeclReader::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) { VisitTemplateDecl(D); + D->ParameterKind = static_cast(Record.readInt()); D->setDeclaredWithTypename(Record.readBool()); // TemplateParmPosition. D->setDepth(Record.readInt()); diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index 555f6325da646b..7c4af76de1eff3 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -1952,6 +1952,7 @@ void ASTDeclWriter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) { Record.push_back(D->getNumExpansionTemplateParameters()); VisitTemplateDecl(D); + Record.push_back(D->kind()); Record.push_back(D->wasDeclaredWithTypename()); // TemplateParmPosition. Record.push_back(D->getDepth()); diff --git a/clang/test/Sema/cxx2c-partially-applied-concepts.cpp b/clang/test/Sema/cxx2c-partially-applied-concepts.cpp deleted file mode 100644 index 15f67888552ea3..00000000000000 --- a/clang/test/Sema/cxx2c-partially-applied-concepts.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// RUN: %clang_cc1 -std=c++2b -verify %s - -template -concept Concept = true; // expected-note 2{{template is declared here}} - -template