diff options
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 82 |
1 files changed, 2 insertions, 80 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 9f62b43..d0d71fa 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -9982,57 +9982,6 @@ cp_parser_trait_expr (cp_parser* parser, enum rid keyword) } } -/* Lambdas that appear in variable initializer or default argument scope - get that in their mangling, so we need to record it. We might as well - use the count for function and namespace scopes as well. */ -static GTY(()) tree lambda_scope; -static GTY(()) int lambda_count; -struct GTY(()) tree_int -{ - tree t; - int i; -}; -static GTY(()) vec<tree_int, va_gc> *lambda_scope_stack; - -static void -start_lambda_scope (tree decl) -{ - tree_int ti; - gcc_assert (decl); - /* Once we're inside a function, we ignore other scopes and just push - the function again so that popping works properly. */ - if (current_function_decl && TREE_CODE (decl) != FUNCTION_DECL) - decl = current_function_decl; - ti.t = lambda_scope; - ti.i = lambda_count; - vec_safe_push (lambda_scope_stack, ti); - if (lambda_scope != decl) - { - /* Don't reset the count if we're still in the same function. */ - lambda_scope = decl; - lambda_count = 0; - } -} - -static void -record_lambda_scope (tree lambda) -{ - LAMBDA_EXPR_EXTRA_SCOPE (lambda) = lambda_scope; - LAMBDA_EXPR_DISCRIMINATOR (lambda) = lambda_count++; -} - -static void -finish_lambda_scope (void) -{ - tree_int *p = &lambda_scope_stack->last (); - if (lambda_scope != p->t) - { - lambda_scope = p->t; - lambda_count = p->i; - } - lambda_scope_stack->pop (); -} - /* Parse a lambda expression. lambda-expression: @@ -10605,29 +10554,14 @@ cp_parser_lambda_body (cp_parser* parser, tree lambda_expr) + ctor_initializer_opt_and_function_body */ { tree fco = lambda_function (lambda_expr); - tree body; + tree body = start_lambda_function (fco, lambda_expr); bool done = false; tree compound_stmt; - tree cap; - - /* Let the front end know that we are going to be defining this - function. */ - start_preparsed_function (fco, - NULL_TREE, - SF_PRE_PARSED | SF_INCLASS_INLINE); - - start_lambda_scope (fco); - body = begin_function_body (); matching_braces braces; if (!braces.require_open (parser)) goto out; - /* Push the proxies for any explicit captures. */ - for (cap = LAMBDA_EXPR_CAPTURE_LIST (lambda_expr); cap; - cap = TREE_CHAIN (cap)) - build_capture_proxy (TREE_PURPOSE (cap)); - compound_stmt = begin_compound_stmt (0); /* 5.1.1.4 of the standard says: @@ -10691,15 +10625,7 @@ cp_parser_lambda_body (cp_parser* parser, tree lambda_expr) finish_compound_stmt (compound_stmt); out: - finish_function_body (body); - finish_lambda_scope (); - - /* Finish the function and generate code for it if necessary. */ - tree fn = finish_function (/*inline*/2); - - /* Only expand if the call op is not a template. */ - if (!DECL_TEMPLATE_INFO (fco)) - expand_or_defer_fn (fn); + finish_lambda_function (body); } restore_omp_privatization_clauses (omp_privatization_save); @@ -26577,8 +26503,6 @@ cp_parser_function_definition_after_declarator (cp_parser* parser, = parser->num_template_parameter_lists; parser->num_template_parameter_lists = 0; - start_lambda_scope (current_function_decl); - /* If the next token is `try', `__transaction_atomic', or `__transaction_relaxed`, then we are looking at either function-try-block or function-transaction-block. Note that all of these include the @@ -26596,8 +26520,6 @@ cp_parser_function_definition_after_declarator (cp_parser* parser, ctor_initializer_p = cp_parser_ctor_initializer_opt_and_function_body (parser, /*in_function_try_block=*/false); - finish_lambda_scope (); - /* Finish the function. */ fn = finish_function ((ctor_initializer_p ? 1 : 0) | (inline_p ? 2 : 0)); |