diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2011-09-29 18:04:05 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-09-29 18:04:05 +0000 |
| commit | 49eedecd702fd7d4f88a1276192f1a2d0d0f4c43 (patch) | |
| tree | bd959fab208060f4ad39829e7cadd4ab6808c7f0 /clang/lib | |
| parent | 70188b3fc24df1cb7d5c4d1f886a8d50ede8731f (diff) | |
| download | bcm5719-llvm-49eedecd702fd7d4f88a1276192f1a2d0d0f4c43.tar.gz bcm5719-llvm-49eedecd702fd7d4f88a1276192f1a2d0d0f4c43.zip | |
Add support for parsing an attribute-specifier-seq containing multiple
attribute-specifiers
llvm-svn: 140794
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 88e93a05b73..ab953dc9c82 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -2556,8 +2556,8 @@ void Parser::PopParsingClass(Sema::ParsingClassState state) { Victim->TemplateScope = getCurScope()->getParent()->isTemplateParamScope(); } -/// ParseCXX0XAttributes - Parse a C++0x attribute-specifier. Currently only -/// parses standard attributes. +/// ParseCXX0XAttributeSpecifier - Parse a C++0x attribute-specifier. Currently +/// only parses standard attributes. /// /// [C++0x] attribute-specifier: /// '[' '[' attribute-list ']' ']' @@ -2591,13 +2591,11 @@ void Parser::PopParsingClass(Sema::ParsingClassState state) { /// '[' balanced-token-seq ']' /// '{' balanced-token-seq '}' /// any token but '(', ')', '[', ']', '{', or '}' -void Parser::ParseCXX0XAttributes(ParsedAttributesWithRange &attrs, - SourceLocation *endLoc) { +void Parser::ParseCXX0XAttributeSpecifier(ParsedAttributes &attrs, + SourceLocation *endLoc) { assert(Tok.is(tok::l_square) && NextToken().is(tok::l_square) && "Not a C++0x attribute list"); - SourceLocation StartLoc = Tok.getLocation(), Loc; - ConsumeBracket(); ConsumeBracket(); @@ -2692,11 +2690,27 @@ void Parser::ParseCXX0XAttributes(ParsedAttributesWithRange &attrs, if (ExpectAndConsume(tok::r_square, diag::err_expected_rsquare)) SkipUntil(tok::r_square, false); - Loc = Tok.getLocation(); + if (endLoc) + *endLoc = Tok.getLocation(); if (ExpectAndConsume(tok::r_square, diag::err_expected_rsquare)) SkipUntil(tok::r_square, false); +} + +/// ParseCXX0XAttributes - Parse a C++0x attribute-specifier-seq. +/// +/// attribute-specifier-seq: +/// attribute-specifier-seq[opt] attribute-specifier +void Parser::ParseCXX0XAttributes(ParsedAttributesWithRange &attrs, + SourceLocation *endLoc) { + SourceLocation StartLoc = Tok.getLocation(), Loc; + if (!endLoc) + endLoc = &Loc; + + do + ParseCXX0XAttributeSpecifier(attrs, endLoc); + while (isCXX0XAttributeSpecifier()); - attrs.Range = SourceRange(StartLoc, Loc); + attrs.Range = SourceRange(StartLoc, *endLoc); } /// ParseCXX0XAlignArgument - Parse the argument to C++0x's [[align]] |

