[clang] [Clang] enhance error recovery with RecoveryExpr for trailing commas in call arguments (PR #114684)

Oleksandr T. via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 00:14:26 PST 2024


================
@@ -3705,6 +3713,12 @@ bool Parser::ParseExpressionList(SmallVectorImpl<Expr *> &Exprs,
     Token Comma = Tok;
     ConsumeToken();
     checkPotentialAngleBracketDelimiter(Comma);
+
+    if (Tok.is(tok::r_paren)) {
+      if (HasTrailingComma)
+        *HasTrailingComma = true;
+      break;
+    }
----------------
a-tarasyuk wrote:

@zyn0217 To handle a trailing comma, the previous token has to be a comma, and the next one a `r_paren`.

https://github.com/llvm/llvm-project/blob/46f43b6d92e49b80df13e8a537a95767ffbaac9f/clang/lib/Parse/ParseExpr.cpp#L3702-L3707



https://github.com/llvm/llvm-project/pull/114684


More information about the cfe-commits mailing list