diff options
author | Anders Carlsson <andersca@mac.com> | 2009-06-12 19:58:00 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-06-12 19:58:00 +0000 |
commit | 01e9e934852f7ed5741687b3cf72a164c526d16b (patch) | |
tree | 3159fec9c4ee1430b11c5580ae75e7276c330fb2 /clang/lib/Parse/ParseTemplate.cpp | |
parent | 310fd4ad03493abe1bc46a1d2b6a5d1177c09199 (diff) | |
download | bcm5719-llvm-01e9e934852f7ed5741687b3cf72a164c526d16b.tar.gz bcm5719-llvm-01e9e934852f7ed5741687b3cf72a164c526d16b.zip |
Parse support for C++0x type parameter packs.
llvm-svn: 73247
Diffstat (limited to 'clang/lib/Parse/ParseTemplate.cpp')
-rw-r--r-- | clang/lib/Parse/ParseTemplate.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp index 2a79b99d29c..30924b217f2 100644 --- a/clang/lib/Parse/ParseTemplate.cpp +++ b/clang/lib/Parse/ParseTemplate.cpp @@ -290,11 +290,11 @@ Parser::ParseTemplateParameterList(unsigned Depth, /// parameter-declaration /// /// type-parameter: (see below) -/// 'class' identifier[opt] +/// 'class' ...[opt] identifier[opt] /// 'class' identifier[opt] '=' type-id -/// 'typename' identifier[opt] +/// 'typename' ...[opt] identifier[opt] /// 'typename' identifier[opt] '=' type-id -/// 'template' '<' template-parameter-list '>' 'class' identifier[opt] +/// 'template' ...[opt] '<' template-parameter-list '>' 'class' identifier[opt] /// 'template' '<' template-parameter-list '>' 'class' identifier[opt] = id-expression Parser::DeclPtrTy Parser::ParseTemplateParameter(unsigned Depth, unsigned Position) { @@ -319,9 +319,9 @@ Parser::ParseTemplateParameter(unsigned Depth, unsigned Position) { /// ParseTemplateTemplateParameter and ParseNonTypeTemplateParameter. /// /// type-parameter: [C++ temp.param] -/// 'class' identifier[opt] +/// 'class' ...[opt] identifier[opt] /// 'class' identifier[opt] '=' type-id -/// 'typename' identifier[opt] +/// 'typename' ...[opt] identifier[opt] /// 'typename' identifier[opt] '=' type-id Parser::DeclPtrTy Parser::ParseTypeParameter(unsigned Depth, unsigned Position){ assert((Tok.is(tok::kw_class) || Tok.is(tok::kw_typename)) && @@ -331,6 +331,14 @@ Parser::DeclPtrTy Parser::ParseTypeParameter(unsigned Depth, unsigned Position){ bool TypenameKeyword = Tok.is(tok::kw_typename); SourceLocation KeyLoc = ConsumeToken(); + // Grab the ellipsis (if given). + bool Ellipsis = false; + SourceLocation EllipsisLoc; + if (getLang().CPlusPlus0x && Tok.is(tok::ellipsis)) { + Ellipsis = true; + EllipsisLoc = ConsumeToken(); + } + // Grab the template parameter name (if given) SourceLocation NameLoc; IdentifierInfo* ParamName = 0; @@ -347,6 +355,7 @@ Parser::DeclPtrTy Parser::ParseTypeParameter(unsigned Depth, unsigned Position){ } DeclPtrTy TypeParam = Actions.ActOnTypeParameter(CurScope, TypenameKeyword, + Ellipsis, EllipsisLoc, KeyLoc, ParamName, NameLoc, Depth, Position); |