diff options
author | Timm Bäder <tbaeder@redhat.com> | 2021-04-01 17:32:40 +0200 |
---|---|---|
committer | Timm Bäder <tbaeder@redhat.com> | 2021-04-01 17:32:40 +0200 |
commit | 908a267b5a3b8dff1cd2af0f5971c05c30aaccb0 (patch) | |
tree | be5ae056cbb30fd592e17e6ce1baaafa839b7887 /clang/lib/Parse/ParseDecl.cpp | |
parent | 1ea9fa8c507ec360cf43faf46d13b149e37c950d (diff) | |
download | llvm-908a267b5a3b8dff1cd2af0f5971c05c30aaccb0.zip llvm-908a267b5a3b8dff1cd2af0f5971c05c30aaccb0.tar.gz llvm-908a267b5a3b8dff1cd2af0f5971c05c30aaccb0.tar.bz2 |
Revert "[clang][parser] Set source ranges for GNU-style attributes"
This reverts commit 1ea9fa8c507ec360cf43faf46d13b149e37c950d.
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index eb567f5..104b1b5 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -162,19 +162,15 @@ void Parser::ParseAttributes(unsigned WhichAttrKinds, /// ',' or ')' are ignored, otherwise they produce a parse error. /// /// We follow the C++ model, but don't allow junk after the identifier. -void Parser::ParseGNUAttributes(ParsedAttributesWithRange &Attrs, - SourceLocation *EndLoc, - LateParsedAttrList *LateAttrs, Declarator *D) { +void Parser::ParseGNUAttributes(ParsedAttributes &attrs, + SourceLocation *endLoc, + LateParsedAttrList *LateAttrs, + Declarator *D) { assert(Tok.is(tok::kw___attribute) && "Not a GNU attribute list!"); - SourceLocation StartLoc = Tok.getLocation(), Loc; - - if (!EndLoc) - EndLoc = &Loc; - while (Tok.is(tok::kw___attribute)) { SourceLocation AttrTokLoc = ConsumeToken(); - unsigned OldNumAttrs = Attrs.size(); + unsigned OldNumAttrs = attrs.size(); unsigned OldNumLateAttrs = LateAttrs ? LateAttrs->size() : 0; if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after, @@ -202,14 +198,14 @@ void Parser::ParseGNUAttributes(ParsedAttributesWithRange &Attrs, SourceLocation AttrNameLoc = ConsumeToken(); if (Tok.isNot(tok::l_paren)) { - Attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0, + attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0, ParsedAttr::AS_GNU); continue; } // Handle "parameterized" attributes if (!LateAttrs || !isAttributeLateParsed(*AttrName)) { - ParseGNUAttributeArgs(AttrName, AttrNameLoc, Attrs, EndLoc, nullptr, + ParseGNUAttributeArgs(AttrName, AttrNameLoc, attrs, endLoc, nullptr, SourceLocation(), ParsedAttr::AS_GNU, D); continue; } @@ -242,8 +238,8 @@ void Parser::ParseGNUAttributes(ParsedAttributesWithRange &Attrs, SourceLocation Loc = Tok.getLocation(); if (ExpectAndConsume(tok::r_paren)) SkipUntil(tok::r_paren, StopAtSemi); - if (EndLoc) - *EndLoc = Loc; + if (endLoc) + *endLoc = Loc; // If this was declared in a macro, attach the macro IdentifierInfo to the // parsed attribute. @@ -255,8 +251,8 @@ void Parser::ParseGNUAttributes(ParsedAttributesWithRange &Attrs, Lexer::getSourceText(ExpansionRange, SM, PP.getLangOpts()); IdentifierInfo *MacroII = PP.getIdentifierInfo(FoundName); - for (unsigned i = OldNumAttrs; i < Attrs.size(); ++i) - Attrs[i].setMacroIdentifier(MacroII, ExpansionRange.getBegin()); + for (unsigned i = OldNumAttrs; i < attrs.size(); ++i) + attrs[i].setMacroIdentifier(MacroII, ExpansionRange.getBegin()); if (LateAttrs) { for (unsigned i = OldNumLateAttrs; i < LateAttrs->size(); ++i) @@ -264,8 +260,6 @@ void Parser::ParseGNUAttributes(ParsedAttributesWithRange &Attrs, } } } - - Attrs.Range = SourceRange(StartLoc, *EndLoc); } /// Determine whether the given attribute has an identifier argument. |