[PATCH] D107693: [Parser] Fix attr infloop on "int x [[c"
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 7 04:28:46 PDT 2021
sammccall created this revision.
sammccall added a reviewer: aaron.ballman.
Herald added a subscriber: jdoerfert.
sammccall requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Similar to ad2d6bbb1435cef0a048c9aed3dcf9617640f222 <https://reviews.llvm.org/rGad2d6bbb1435cef0a048c9aed3dcf9617640f222>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D107693
Files:
clang/lib/Parse/ParseDeclCXX.cpp
clang/test/Parser/cxx-attributes.cpp
Index: clang/test/Parser/cxx-attributes.cpp
===================================================================
--- clang/test/Parser/cxx-attributes.cpp
+++ clang/test/Parser/cxx-attributes.cpp
@@ -42,3 +42,6 @@
[[,,maybe_unused,]] int Commas4; // ok
[[foo bar]] int NoComma; // expected-error {{expected ','}} \
// expected-warning {{unknown attribute 'foo' ignored}}
+// expected-error at +2 2 {{expected ']'}}
+// expected-error at +1 {{expected external declaration}}
+[[foo
Index: clang/lib/Parse/ParseDeclCXX.cpp
===================================================================
--- clang/lib/Parse/ParseDeclCXX.cpp
+++ clang/lib/Parse/ParseDeclCXX.cpp
@@ -4385,7 +4385,7 @@
llvm::SmallDenseMap<IdentifierInfo*, SourceLocation, 4> SeenAttrs;
bool AttrParsed = false;
- while (!Tok.isOneOf(tok::r_square, tok::semi)) {
+ while (!Tok.isOneOf(tok::r_square, tok::semi, tok::eof)) {
if (AttrParsed) {
// If we parsed an attribute, a comma is required before parsing any
// additional attributes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107693.364953.patch
Type: text/x-patch
Size: 1051 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210807/07e18f77/attachment.bin>
More information about the cfe-commits
mailing list