[PATCH] D33339: Fix valid-for-expr ellipses eaten as invalid decl

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 18 14:59:32 PDT 2017


hubert.reinterpretcast added inline comments.


================
Comment at: lib/Parse/ParseTentative.cpp:542
+                 (Tok.is(tok::greatergreater) ||
+                  (Tok.is(tok::ellipsis) &&
+                   NextToken().isOneOf(tok::greater, tok::greatergreater,
----------------
The change here is primarily for maintainability purposes. This is "morally" where the ellipsis should be checked for, but the ellipsis that we are looking for here is going to be consumed as "stray" anyway.


================
Comment at: lib/Parse/ParseTentative.cpp:944
+        (mayHaveTrailingStrayEllipsis ||
+         !(NextToken().is(tok::r_paren) || NextToken().is(tok::comma))))
       ConsumeToken();
----------------
The check for what qualifies as "trailing" is not the strongest, but I find it to be the most straightforward change that should do the job. One alternative is to track whether an ellipsis was consumed within the current loop iteration.


https://reviews.llvm.org/D33339





More information about the cfe-commits mailing list