[cfe-commits] r73261 - in /cfe/trunk: include/clang/AST/DeclTemplate.h lib/AST/DeclPrinter.cpp lib/AST/DeclTemplate.cpp lib/Sema/SemaTemplate.cpp
Anders Carlsson
andersca at mac.com
Fri Jun 12 15:23:22 PDT 2009
Author: andersca
Date: Fri Jun 12 17:23:22 2009
New Revision: 73261
URL: http://llvm.org/viewvc/llvm-project?rev=73261&view=rev
Log:
Keep track of whether a type parameter is actually a type parameter pack.
Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/lib/AST/DeclTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=73261&r1=73260&r2=73261&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Fri Jun 12 17:23:22 2009
@@ -233,6 +233,9 @@
/// default argument.
bool InheritedDefault : 1;
+ /// \brief Whether this is a parameter pack.
+ bool ParameterPack : 1;
+
/// \brief The location of the default argument, if any.
SourceLocation DefaultArgumentLoc;
@@ -240,16 +243,17 @@
QualType DefaultArgument;
TemplateTypeParmDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
- bool Typename, QualType Type)
+ bool Typename, QualType Type, bool ParameterPack)
: TypeDecl(TemplateTypeParm, DC, L, Id), Typename(Typename),
- InheritedDefault(false), DefaultArgument() {
+ InheritedDefault(false), ParameterPack(ParameterPack), DefaultArgument() {
TypeForDecl = Type.getTypePtr();
}
public:
static TemplateTypeParmDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L, unsigned D, unsigned P,
- IdentifierInfo *Id, bool Typename);
+ IdentifierInfo *Id, bool Typename,
+ bool ParameterPack);
/// \brief Whether this template type parameter was declared with
/// the 'typename' keyword. If not, it was declared with the 'class'
@@ -280,6 +284,9 @@
InheritedDefault = Inherited;
}
+ /// \brief Returns whether this is a parameter pack.
+ bool isParameterPack() const { return ParameterPack; }
+
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) {
return D->getKind() == TemplateTypeParm;
Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=73261&r1=73260&r2=73261&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Fri Jun 12 17:23:22 2009
@@ -527,6 +527,9 @@
else
Out << "class ";
+ if (TTP->isParameterPack())
+ Out << "... ";
+
Out << ParamType.getAsString(Policy);
if (TTP->hasDefaultArgument()) {
Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=73261&r1=73260&r2=73261&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Fri Jun 12 17:23:22 2009
@@ -186,9 +186,10 @@
TemplateTypeParmDecl *
TemplateTypeParmDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L, unsigned D, unsigned P,
- IdentifierInfo *Id, bool Typename) {
+ IdentifierInfo *Id, bool Typename,
+ bool ParameterPack) {
QualType Type = C.getTemplateTypeParmType(D, P, Id);
- return new (C) TemplateTypeParmDecl(DC, L, Id, Typename, Type);
+ return new (C) TemplateTypeParmDecl(DC, L, Id, Typename, Type, ParameterPack);
}
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=73261&r1=73260&r2=73261&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Jun 12 17:23:22 2009
@@ -163,7 +163,8 @@
TemplateTypeParmDecl *Param
= TemplateTypeParmDecl::Create(Context, CurContext, Loc,
- Depth, Position, ParamName, Typename);
+ Depth, Position, ParamName, Typename,
+ Ellipsis);
if (Invalid)
Param->setInvalidDecl();
More information about the cfe-commits
mailing list