diff mbox series

[C++] Simplify lambda parsing.

Message ID 20200119185429.27412-1-jason@redhat.com
State New
Headers show
Series [C++] Simplify lambda parsing. | expand

Commit Message

Jason Merrill Jan. 19, 2020, 6:54 p.m. UTC
Since we removed the special parsing for C++11 lambdas, it's just been an
open-coded copy of cp_parser_function_body.  So let's call it instead.  This
avoids the need to change this code in my revised 33799 patch.

Tested x86_64-pc-linux-gnu, applying to trunk.

	* parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
---
 gcc/cp/parser.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)


base-commit: 52354dadb80b60c3fd05fb1b5aa3feb15a98b8af
diff mbox series

Patch

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 75e32fcebcb..98c1beb400f 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -11141,23 +11141,11 @@  cp_parser_lambda_body (cp_parser* parser, tree lambda_expr)
     local_specialization_stack s (lss_copy);
     tree fco = lambda_function (lambda_expr);
     tree body = start_lambda_function (fco, lambda_expr);
-    matching_braces braces;
 
-    if (braces.require_open (parser))
-      {
-	tree compound_stmt = begin_compound_stmt (0);
-
-	/* Originally C++11 required us to peek for 'return expr'; and
-	   process it specially here to deduce the return type.  N3638
-	   removed the need for that.  */
-
-	while (cp_lexer_next_token_is_keyword (parser->lexer, RID_LABEL))
-	  cp_parser_label_declaration (parser);
-	cp_parser_statement_seq_opt (parser, NULL_TREE);
-	braces.require_close (parser);
-
-	finish_compound_stmt (compound_stmt);
-      }
+    /* Originally C++11 required us to peek for 'return expr'; and
+       process it specially here to deduce the return type.  N3638
+       removed the need for that.  */
+    cp_parser_function_body (parser, false);
 
     finish_lambda_function (body);
   }