diff options
Diffstat (limited to 'clang/lib/Parse/ParseDeclCXX.cpp')
| -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]] |

