From 61c4d28e36cd3f1be392cb77f07436d1fa6b0f9f Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 5 Jan 2011 15:48:55 +0000 Subject: [PATCH] Implement support for template template parameter packs, e.g., template class ...Metafunctions> struct apply_to_each; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122874 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/DeclTemplate.h | 12 +++-- include/clang/Sema/Sema.h | 3 +- lib/AST/ASTContext.cpp | 8 +-- lib/AST/ASTImporter.cpp | 1 + lib/AST/DeclBase.cpp | 5 +- lib/AST/DeclPrinter.cpp | 7 ++- lib/AST/DeclTemplate.cpp | 5 +- lib/AST/StmtProfile.cpp | 3 +- lib/Parse/ParseTemplate.cpp | 31 +++++++---- lib/Sema/SemaTemplate.cpp | 51 +++++++++++-------- lib/Sema/SemaTemplateInstantiate.cpp | 19 +++++-- lib/Sema/SemaTemplateInstantiateDecl.cpp | 4 +- lib/Sema/SemaTemplateVariadic.cpp | 12 ++++- lib/Serialization/ASTReaderDecl.cpp | 4 +- lib/Serialization/ASTWriterDecl.cpp | 1 + .../temp.variadic/metafunctions.cpp | 26 ++++++++++ test/CXX/temp/temp.decls/temp.variadic/p5.cpp | 5 ++ .../temp.variadic/parameter-matching.cpp | 2 + test/CXX/temp/temp.param/p9-0x.cpp | 4 ++ 19 files changed, 152 insertions(+), 51 deletions(-) diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index f2f91786bc..b20aeeb74a 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -1084,18 +1084,22 @@ class TemplateTemplateParmDecl /// Whether or not the default argument was inherited. bool DefaultArgumentWasInherited; + /// \brief Whether this parameter is a parameter pack. + bool ParameterPack; + TemplateTemplateParmDecl(DeclContext *DC, SourceLocation L, - unsigned D, unsigned P, + unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params) : TemplateDecl(TemplateTemplateParm, DC, L, Id, Params), TemplateParmPosition(D, P), DefaultArgument(), - DefaultArgumentWasInherited(false) + DefaultArgumentWasInherited(false), ParameterPack(ParameterPack) { } public: static TemplateTemplateParmDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, - unsigned P, IdentifierInfo *Id, + unsigned P, bool ParameterPack, + IdentifierInfo *Id, TemplateParameterList *Params); using TemplateParmPosition::getDepth; @@ -1108,7 +1112,7 @@ public: /// \code /// template