diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2019-06-18 12:57:05 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2019-06-18 12:57:05 +0000 |
commit | e7e376f27ad1f742ba39aa1a0578b8720aa38d46 (patch) | |
tree | 9071539e97a6d3c3039a88a00ff473335e341123 /lib/Parse/ParseDecl.cpp | |
parent | ed5d336001af604641d7fd4f00b752a442d73d0f (diff) | |
download | clang-e7e376f27ad1f742ba39aa1a0578b8720aa38d46.tar.gz |
Require commas to separate multiple GNU-style attributes in the same attribute list.
Fixes PR38352.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363676 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 2c9045d74a..0b57c8ab66 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -164,10 +164,10 @@ void Parser::ParseGNUAttributes(ParsedAttributes &attrs, return; } // Parse the attribute-list. e.g. __attribute__(( weak, alias("__f") )) - while (true) { - // Allow empty/non-empty attributes. ((__vector_size__(16),,,,)) - if (TryConsumeToken(tok::comma)) - continue; + do { + // Eat preceeding commas to allow __attribute__((,,,foo)) + while (TryConsumeToken(tok::comma)) + ; // Expect an identifier or declaration specifier (const, int, etc.) if (Tok.isAnnotation()) @@ -212,7 +212,7 @@ void Parser::ParseGNUAttributes(ParsedAttributes &attrs, Eof.startToken(); Eof.setLocation(Tok.getLocation()); LA->Toks.push_back(Eof); - } + } while (Tok.is(tok::comma)); if (ExpectAndConsume(tok::r_paren)) SkipUntil(tok::r_paren, StopAtSemi); |