From e7e376f27ad1f742ba39aa1a0578b8720aa38d46 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 18 Jun 2019 12:57:05 +0000 Subject: 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 --- lib/Parse/ParseDecl.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/Parse/ParseDecl.cpp') 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); -- cgit v1.2.1