llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-modules Author: Matheus Izvekov (mizvekov) <details> <summary>Changes</summary> Relands https://github.com/llvm/llvm-project/pull/199528 Previous: #<!-- -->201373 This implements a new strategy for collecting the template arguments, by relying on the qualifiers and template parameter lists to navigate the template context of out-of-line definitions. This greatly simplifies the signature of that function, by removing a bunch of workarounds, and simpliffying a couple that weren't removed yet. Since this now relies on qualifiers and template parameter lists, this patch expends most of its effort making sure these are placed, transformed and propagated to template instantiations. Also makes the explicit specialization AST nodes stop abusing the template parameter lists by storing it's own template parameter list, creating a dedicated field for them, similar to partial specializations. --- Patch is 273.41 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/202088.diff 62 Files Affected: - (modified) clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp (+1-1) - (modified) clang-tools-extra/clangd/SemanticHighlighting.cpp (+21-18) - (modified) clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp (+1-1) - (modified) clang/docs/ReleaseNotes.rst (+1) - (modified) clang/include/clang/AST/Decl.h (+21-37) - (modified) clang/include/clang/AST/DeclTemplate.h (+96-95) - (modified) clang/include/clang/AST/JSONNodeDumper.h (+1) - (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+8-6) - (modified) clang/include/clang/ASTMatchers/ASTMatchers.h (+5) - (modified) clang/include/clang/ASTMatchers/ASTMatchersInternal.h (+2-6) - (modified) clang/include/clang/Basic/Specifiers.h (+3) - (modified) clang/include/clang/Sema/Sema.h (+42-101) - (modified) clang/lib/AST/ASTContext.cpp (+2) - (modified) clang/lib/AST/ASTDumper.cpp (+1) - (modified) clang/lib/AST/ASTImporter.cpp (+97-34) - (modified) clang/lib/AST/Comment.cpp (+6-4) - (modified) clang/lib/AST/Decl.cpp (+36-9) - (modified) clang/lib/AST/DeclPrinter.cpp (+1) - (modified) clang/lib/AST/DeclTemplate.cpp (+62-94) - (modified) clang/lib/AST/JSONNodeDumper.cpp (+3) - (modified) clang/lib/AST/TextNodeDumper.cpp (+3) - (modified) clang/lib/ASTMatchers/Dynamic/Registry.cpp (+1) - (modified) clang/lib/Analysis/ExprMutationAnalyzer.cpp (+8-5) - (modified) clang/lib/CIR/CodeGen/CIRGenVTables.cpp (+2) - (modified) clang/lib/CodeGen/CGVTables.cpp (+17-15) - (modified) clang/lib/Index/IndexingContext.cpp (+1) - (modified) clang/lib/InstallAPI/Visitor.cpp (+5) - (modified) clang/lib/Parse/ParseDeclCXX.cpp (+8-6) - (modified) clang/lib/Sema/HLSLExternalSemaSource.cpp (+7-8) - (modified) clang/lib/Sema/SemaConcept.cpp (+59-129) - (modified) clang/lib/Sema/SemaDecl.cpp (+27-26) - (modified) clang/lib/Sema/SemaDeclCXX.cpp (+7-4) - (modified) clang/lib/Sema/SemaExprMember.cpp (+2-3) - (modified) clang/lib/Sema/SemaOverload.cpp (+4-2) - (modified) clang/lib/Sema/SemaTemplate.cpp (+150-146) - (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+13-32) - (modified) clang/lib/Sema/SemaTemplateDeductionGuide.cpp (+7-50) - (modified) clang/lib/Sema/SemaTemplateInstantiate.cpp (+188-423) - (modified) clang/lib/Sema/SemaTemplateInstantiateDecl.cpp (+277-167) - (modified) clang/lib/Serialization/ASTReaderDecl.cpp (+41-36) - (modified) clang/lib/Serialization/ASTWriterDecl.cpp (+61-39) - (modified) clang/lib/StaticAnalyzer/Core/BugSuppression.cpp (+10-81) - (modified) clang/lib/Tooling/Syntax/BuildTree.cpp (+7-6) - (modified) clang/test/AST/ast-dump-templates-pattern.cpp (+10-9) - (modified) clang/test/CXX/basic/basic.link/p11.cpp (-2) - (modified) clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp (+4-7) - (modified) clang/test/CXX/temp/temp.constr/temp.constr.decl/p4.cpp (+2-15) - (modified) clang/test/CXX/temp/temp.decls/temp.spec.partial/temp.spec.partial.member/p2.cpp (+1) - (modified) clang/test/CXX/temp/temp.spec/temp.expl.spec/p7.cpp (-23) - (modified) clang/test/CodeGenCXX/default-arguments.cpp (+12) - (modified) clang/test/CodeGenCXX/explicit-instantiation.cpp (+7) - (modified) clang/test/SemaCXX/deduced-return-type-cxx14.cpp (+8) - (modified) clang/test/SemaTemplate/concepts-out-of-line-def.cpp (+2-7) - (modified) clang/test/SemaTemplate/friend-template.cpp (+8) - (modified) clang/test/SemaTemplate/instantiate-scope.cpp (+4-6) - (modified) clang/test/Templight/templight-default-func-arg.cpp (+23-10) - (modified) clang/test/Templight/templight-empty-entries-fix.cpp (+50-38) - (modified) clang/tools/libclang/CIndex.cpp (+1) - (modified) clang/unittests/AST/ASTImporterTest.cpp (+4-2) - (modified) clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp (+2-2) - (modified) lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp (+4-8) - (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+46-2) ``````````diff diff --git a/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp b/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp index ae063a19d779d..a1a705dd043a0 100644 --- a/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp @@ -106,7 +106,7 @@ void DefinitionsInHeadersCheck::check(const MatchFinder::MatchResult &Result) { return; diag(FD->getLocation(), "mark the definition as 'inline'", DiagnosticIDs::Note) - << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline "); + << FixItHint::CreateInsertion(FD->getFunctionLocStart(), "inline "); } else if (const auto *VD = dyn_cast<VarDecl>(ND)) { // C++14 variable templates are allowed. if (VD->getDescribedVarTemplate()) diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp b/clang-tools-extra/clangd/SemanticHighlighting.cpp index d1ed3ea9bc88a..856904bc810d1 100644 --- a/clang-tools-extra/clangd/SemanticHighlighting.cpp +++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -590,28 +590,28 @@ class CollectExtraHighlightings bool VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D) { - if (auto *Args = D->getTemplateArgsAsWritten()) - H.addAngleBracketTokens(Args->getLAngleLoc(), Args->getRAngleLoc()); - return true; - } - - bool VisitClassTemplatePartialSpecializationDecl( - ClassTemplatePartialSpecializationDecl *D) { - if (auto *TPL = D->getTemplateParameters()) - H.addAngleBracketTokens(TPL->getLAngleLoc(), TPL->getRAngleLoc()); + if (const auto *Info = D->getExplicitInstantiationInfo()) { + H.addAngleBracketTokens(Info->TemplateArgsAsWritten->getLAngleLoc(), + Info->TemplateArgsAsWritten->getRAngleLoc()); + } else if (const auto *Info = D->getExplicitSpecializationInfo()) { + H.addAngleBracketTokens(Info->TemplateParams->getLAngleLoc(), + Info->TemplateParams->getRAngleLoc()); + H.addAngleBracketTokens(Info->TemplateArgsAsWritten->getLAngleLoc(), + Info->TemplateArgsAsWritten->getRAngleLoc()); + } return true; } bool VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D) { - if (auto *Args = D->getTemplateArgsAsWritten()) - H.addAngleBracketTokens(Args->getLAngleLoc(), Args->getRAngleLoc()); - return true; - } - - bool VisitVarTemplatePartialSpecializationDecl( - VarTemplatePartialSpecializationDecl *D) { - if (auto *TPL = D->getTemplateParameters()) - H.addAngleBracketTokens(TPL->getLAngleLoc(), TPL->getRAngleLoc()); + if (const auto *Info = D->getExplicitInstantiationInfo()) { + H.addAngleBracketTokens(Info->TemplateArgsAsWritten->getLAngleLoc(), + Info->TemplateArgsAsWritten->getRAngleLoc()); + } else if (const auto *Info = D->getExplicitSpecializationInfo()) { + H.addAngleBracketTokens(Info->TemplateParams->getLAngleLoc(), + Info->TemplateParams->getRAngleLoc()); + H.addAngleBracketTokens(Info->TemplateArgsAsWritten->getLAngleLoc(), + Info->TemplateArgsAsWritten->getRAngleLoc()); + } return true; } @@ -625,6 +625,9 @@ class CollectExtraHighlightings } bool VisitFunctionDecl(FunctionDecl *D) { + if (const TemplateParameterList *TPL = + D->getTemplateSpecializationParameters()) + H.addAngleBracketTokens(TPL->getLAngleLoc(), TPL->getRAngleLoc()); if (D->isOverloadedOperator()) { const auto AddOpDeclToken = [&](SourceLocation Loc) { auto &Token = H.addToken(Loc, HighlightingKind::Operator) diff --git a/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp b/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp index c9704492bf1cd..5fcb1a24448b8 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp @@ -364,7 +364,7 @@ addInlineIfInHeader(const FunctionDecl *FD) { if (!isHeaderFile(FileName, FD->getASTContext().getLangOpts())) return std::nullopt; - return tooling::Replacement(SM, FD->getInnerLocStart(), 0, "inline "); + return tooling::Replacement(SM, FD->getFunctionLocStart(), 0, "inline "); } /// Moves definition of a function/method to its declaration location. diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index bf917b3f642bc..f97e90634396a 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -702,6 +702,7 @@ Bug Fixes to C++ Support - Fixed an alias template CTAD crash. - Correctly diagnose uses of ``co_await`` / ``co_yield`` in the default argument of nested function declarations. (#GH98923) - Fixed a crash when diagnosing an invalid static member function with an explicit object parameter (#GH177741) +- Fixed clang incorrectly rejecting several cases of out-of-line definitions. (#GH101330) - Clang incorrectly instantiated variable specializations outside of the immediate context. (#GH54439) - Fixed a crash when pack expansions are used as arguments for non-pack parameters of built-in templates. (#GH180307) - Fixed crash instantiating class member specializations. diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index 620206612f98f..e3f513732e588 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -2122,34 +2122,6 @@ class FunctionDecl : public DeclaratorDecl, /// the DeclaratorDecl base class. DeclarationNameLoc DNLoc; - /// Specify that this function declaration is actually a function - /// template specialization. - /// - /// \param C the ASTContext. - /// - /// \param Template the function template that this function template - /// specialization specializes. - /// - /// \param TemplateArgs the template arguments that produced this - /// function template specialization from the template. - /// - /// \param InsertPos If non-NULL, the position in the function template - /// specialization set where the function template specialization data will - /// be inserted. - /// - /// \param TSK the kind of template specialization this is. - /// - /// \param TemplateArgsAsWritten location info of template arguments. - /// - /// \param PointOfInstantiation point at which the function template - /// specialization was first instantiated. - void setFunctionTemplateSpecialization( - ASTContext &C, FunctionTemplateDecl *Template, - TemplateArgumentList *TemplateArgs, void *InsertPos, - TemplateSpecializationKind TSK, - const TemplateArgumentListInfo *TemplateArgsAsWritten, - SourceLocation PointOfInstantiation); - /// Specify that this record is an instantiation of the /// member function FD. void setInstantiationOfMemberFunction(ASTContext &C, FunctionDecl *FD, @@ -2245,6 +2217,8 @@ class FunctionDecl : public DeclaratorDecl, return SourceLocation(); } + SourceLocation getFunctionLocStart() const; + SourceRange getSourceRange() const override LLVM_READONLY; // Function definitions. @@ -3070,9 +3044,14 @@ class FunctionDecl : public DeclaratorDecl, const ASTTemplateArgumentListInfo* getTemplateSpecializationArgsAsWritten() const; + /// Returns the template parameter list for an explicit specialization. + const TemplateParameterList *getTemplateSpecializationParameters() const; + /// Specify that this function declaration is actually a function /// template specialization. /// + /// \param C the ASTContext. + /// /// \param Template the function template that this function template /// specialization specializes. /// @@ -3085,25 +3064,30 @@ class FunctionDecl : public DeclaratorDecl, /// /// \param TSK the kind of template specialization this is. /// + /// \param TemplateParams the template parameters if this is an explicit + /// specialization. + /// /// \param TemplateArgsAsWritten location info of template arguments. /// /// \param PointOfInstantiation point at which the function template /// specialization was first instantiated. + /// + /// \param AddSpecialization whether to add this specialization to the + /// template's specialization set. + /// void setFunctionTemplateSpecialization( - FunctionTemplateDecl *Template, TemplateArgumentList *TemplateArgs, - void *InsertPos, - TemplateSpecializationKind TSK = TSK_ImplicitInstantiation, - TemplateArgumentListInfo *TemplateArgsAsWritten = nullptr, - SourceLocation PointOfInstantiation = SourceLocation()) { - setFunctionTemplateSpecialization(getASTContext(), Template, TemplateArgs, - InsertPos, TSK, TemplateArgsAsWritten, - PointOfInstantiation); - } + ASTContext &C, FunctionTemplateDecl *Template, + TemplateArgumentList *TemplateArgs, void *InsertPos, + TemplateSpecializationKind TSK, + const TemplateParameterList *TemplateParams, + const TemplateArgumentListInfo *TemplateArgsAsWritten, + SourceLocation PointOfInstantiation, bool AddSpecialization); /// Specifies that this function declaration is actually a /// dependent function template specialization. void setDependentTemplateSpecialization( ASTContext &Context, const UnresolvedSetImpl &Templates, + const TemplateParameterList *TemplateParams, const TemplateArgumentListInfo *TemplateArgs); DependentFunctionTemplateSpecializationInfo * diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h index 4f5a4e1b7b8a6..672648c3fc03c 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/include/clang/AST/DeclTemplate.h @@ -73,7 +73,7 @@ class TemplateParameterList final : private llvm::TrailingObjects<TemplateParameterList, NamedDecl *, Expr *> { /// The template argument list of the template parameter list. - TemplateArgument *InjectedArgs = nullptr; + mutable TemplateArgument *InjectedArgs = nullptr; /// The location of the 'template' keyword. SourceLocation TemplateLoc; @@ -200,7 +200,8 @@ class TemplateParameterList final bool hasAssociatedConstraints() const; /// Get the template argument list of the template parameter list. - ArrayRef<TemplateArgument> getInjectedTemplateArgs(const ASTContext &Context); + ArrayRef<TemplateArgument> + getInjectedTemplateArgs(const ASTContext &Context) const; SourceLocation getTemplateLoc() const { return TemplateLoc; } SourceLocation getLAngleLoc() const { return LAngleLoc; } @@ -475,14 +476,18 @@ class FunctionTemplateSpecializationInfo final /// The function template from which this function template /// specialization was generated. /// - /// The two bits contain the top 4 values of TemplateSpecializationKind. - llvm::PointerIntPair<FunctionTemplateDecl *, 2> Template; + /// The three bits contain the TemplateSpecializationKind. + llvm::PointerIntPair<FunctionTemplateDecl *, 3> Template; public: /// The template arguments used to produce the function template /// specialization from the function template. TemplateArgumentList *TemplateArguments; + // The template parameters if this is an explicit specialization. + /// FIXME: Normally null; tail-allocate this. + const TemplateParameterList *TemplateParameters; + /// The template arguments as written in the sources, if provided. /// FIXME: Normally null; tail-allocate this. const ASTTemplateArgumentListInfo *TemplateArgumentsAsWritten; @@ -495,12 +500,14 @@ class FunctionTemplateSpecializationInfo final FunctionTemplateSpecializationInfo( FunctionDecl *FD, FunctionTemplateDecl *Template, TemplateSpecializationKind TSK, TemplateArgumentList *TemplateArgs, + const TemplateParameterList *TemplateParameters, const ASTTemplateArgumentListInfo *TemplateArgsAsWritten, SourceLocation POI, MemberSpecializationInfo *MSInfo) : Function(FD, MSInfo ? true : false), Template(Template, TSK - 1), - TemplateArguments(TemplateArgs), + TemplateArguments(TemplateArgs), TemplateParameters(TemplateParameters), TemplateArgumentsAsWritten(TemplateArgsAsWritten), PointOfInstantiation(POI) { + assert(TemplateParameters == nullptr || TSK == TSK_ExplicitSpecialization); if (MSInfo) getTrailingObjects()[0] = MSInfo; } @@ -513,6 +520,7 @@ class FunctionTemplateSpecializationInfo final static FunctionTemplateSpecializationInfo * Create(ASTContext &C, FunctionDecl *FD, FunctionTemplateDecl *Template, TemplateSpecializationKind TSK, TemplateArgumentList *TemplateArgs, + const TemplateParameterList *TemplateParameters, const TemplateArgumentListInfo *TemplateArgsAsWritten, SourceLocation POI, MemberSpecializationInfo *MSInfo); @@ -613,8 +621,8 @@ class FunctionTemplateSpecializationInfo final /// member class or member enumeration. class MemberSpecializationInfo { // The member declaration from which this member was instantiated, and the - // manner in which the instantiation occurred (in the lower two bits). - llvm::PointerIntPair<NamedDecl *, 2> MemberAndTSK; + // manner in which the instantiation occurred (in the lower three bits). + llvm::PointerIntPair<NamedDecl *, 3> MemberAndTSK; // The point at which this member was first instantiated. SourceLocation PointOfInstantiation; @@ -693,14 +701,19 @@ class DependentFunctionTemplateSpecializationInfo final DependentFunctionTemplateSpecializationInfo( const UnresolvedSetImpl &Candidates, + const TemplateParameterList *TemplateParams, const ASTTemplateArgumentListInfo *TemplateArgsWritten); public: + // The template parameters if this is an explicit specialization. + const TemplateParameterList *TemplateParameters; + /// The template arguments as written in the sources, if provided. const ASTTemplateArgumentListInfo *TemplateArgumentsAsWritten; static DependentFunctionTemplateSpecializationInfo * Create(ASTContext &Context, const UnresolvedSetImpl &Candidates, + const TemplateParameterList *TemplateParams, const TemplateArgumentListInfo *TemplateArgs); /// Returns the candidates for the primary function template. @@ -1005,11 +1018,6 @@ class FunctionTemplateDecl : public RedeclarableTemplateDecl { return getTemplatedDecl()->isThisDeclarationADefinition(); } - bool isCompatibleWithDefinition() const { - return getTemplatedDecl()->isInstantiatedFromMemberTemplate() || - isThisDeclarationADefinition(); - } - // This bit closely tracks 'RedeclarableTemplateDecl::InstantiatedFromMember', // except this is per declaration, while the redeclarable field is // per chain. This indicates a template redeclaration which @@ -1807,8 +1815,18 @@ struct ExplicitInstantiationInfo { ExplicitInstantiationInfo() = default; }; +struct ExplicitSpecializationInfo { + /// The list of template parameters + TemplateParameterList *TemplateParams = nullptr; + + /// The template arguments as written. + const ASTTemplateArgumentListInfo *TemplateArgsAsWritten = nullptr; + + ExplicitSpecializationInfo() = default; +}; + using SpecializationOrInstantiationInfo = - llvm::PointerUnion<const ASTTemplateArgumentListInfo *, + llvm::PointerUnion<ExplicitSpecializationInfo *, ExplicitInstantiationInfo *>; /// Represents a class template specialization, which refers to @@ -2038,49 +2056,38 @@ class ClassTemplateSpecializationDecl : public CXXRecordDecl, /// Retrieve the template argument list as written in the sources, /// if any. const ASTTemplateArgumentListInfo *getTemplateArgsAsWritten() const { - if (auto *Info = - dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo)) + if (const auto *Info = getExplicitSpecializationInfo()) return Info->TemplateArgsAsWritten; - return cast<const ASTTemplateArgumentListInfo *>(ExplicitInfo); - } - - /// Set the template argument list as written in the sources. - void - setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten) { - if (auto *Info = - dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo)) - Info->TemplateArgsAsWritten = ArgsWritten; - else - ExplicitInfo = ArgsWritten; + if (const auto *Info = getExplicitInstantiationInfo()) + return Info->TemplateArgsAsWritten; + return nullptr; } - /// Set the template argument list as written in the sources. - void setTemplateArgsAsWritten(const TemplateArgumentListInfo &ArgsInfo) { - setTemplateArgsAsWritten( - ASTTemplateArgumentListInfo::Create(getASTContext(), ArgsInfo)); + /// Gets the explicit instantiation info, if present. + const ExplicitInstantiationInfo *getExplicitInstantiationInfo() const { + return dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo); } - /// Gets the location of the extern keyword, if present. - SourceLocation getExternKeywordLoc() const { - if (auto *Info = - dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo)) - return Info->ExternKeywordLoc; - return SourceLocation(); + /// Sets the explicit instantiation info. + void setExplicitInstantiationInfo( + SourceLocation ExternKeywordLoc, SourceLocation TemplateKeywordLoc, + const ASTTemplateArgumentListInfo *TemplateArgsAsWritten) { + auto *Info = new (getASTContext()) ExplicitInstantiationInfo(); + Info->ExternKeywordLoc = ExternKeywordLoc; + Info->TemplateKeywordLoc = TemplateKeywordLoc; + Info->TemplateArgsAsWritten = TemplateArgsAsWritten; + ExplicitInfo = Info; } - /// Sets the location of the extern keyword. - void setExternKeywordLoc(SourceLocation Loc); - - /// Gets the location of the template keyword, if present. - SourceLocation getTemplateKeywordLoc() const { - if (auto *Info = - dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo)) - return Info->TemplateKeywordLoc; - return SourceLocation(); + /// Gets the explicit specialization info, if present. + const ExplicitSpecializationInfo *getExplicitSpecializationInfo() const { + return dyn_cast_if_present<ExplicitSpecializationInfo *>(ExplicitInfo); } - /// Sets the location of the template keyword. - void setTemplateKeywordLoc(SourceLocation Loc); + /// Sets the explicit specialization info. + void setExplicitSpecializationInfo( + TemplateParameterList *TemplateParams, + const ASTTemplateArgumentListInfo *TemplateArgsAsWritten); SourceRange getSourceRange() const override LLVM_READONLY; @@ -2105,10 +2112,7 @@ class ClassTemplateSpecializationDecl : public CXXRecordDecl, }; class ClassTemplatePartialSpecializationDecl - : public ClassTemplateSpecializationDecl { - /// The list of template parameters - TemplateParameterList *TemplateParams = nullptr; - + : public ClassTemplateSpecializationDecl { /// The class template partial specialization from which this /// class template partial specialization was instantiated. /// @@ -2122,6 +2126,7 @@ class ClassTemplatePartialSpecializationDecl ClassTemplatePartialSpecializationDecl( ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, + const ASTTemplateArgumentListInfo *ArgsAsWritten, ClassTemplateDecl *SpecializedTemplate, ArrayRef<TemplateArgument> Args, CanQualType CanonInjectedTST, ClassTemplatePartialSpecializationDecl *PrevDecl); @@ -2139,7 +2144,9 @@ class ClassTemplatePartialSpecializationDecl static ClassTemplatePartialSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, - TemplateParameterList *Params, ClassTemplateDecl *SpecializedTemplate, + TemplateParameterList *Params, + const ASTTemplateArgumentListInfo *TemplateArgsAsWritten, + ClassTemplateDecl *SpecializedTemplate, ArrayRef<TemplateArgument> Args, CanQualType CanonInjectedTST, ClassTemplatePartialSpecializationDecl *PrevDecl); @@ -2154,7 +2161,10 @@ class ClassTemplatePartial... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/202088 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
