Require commas to separate multiple GNU-style attributes in the same attribute list.
Fixes PR38352.
llvm-svn: 363676
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 2c9045d..0b57c8a 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -164,10 +164,10 @@
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 @@
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);