From ca3edeaed691cf971ebdf7768f5d73b182c1aa07 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 31 May 2019 13:25:46 +0000 Subject: [C++PATCH] Lambda names are anonymous https://gcc.gnu.org/ml/gcc-patches/2019-05/msg02126.html * cp-tree.h (IDENTIFIER_LAMBDA_P): New. (TYPE_ANON_P): New. (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise. (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete. (make_lambda_name): Don't declare. * error.c (dump_aggr_type): Check for lambdas before other anonymous names. * lambda.c (begin_lambda_type): Use make_anon_name. * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous. * mangle.c (write_local_name): Likewise. * name-lookup.c (lambda_cnt, make_lambda_name): Delete. From-SVN: r271811 --- gcc/cp/lambda.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'gcc/cp/lambda.c') diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index fb385c6..758773b 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -128,22 +128,15 @@ build_lambda_object (tree lambda_expr) tree begin_lambda_type (tree lambda) { - tree type; + /* Lambda names are nearly but not quite anonymous. */ + tree name = make_anon_name (); + IDENTIFIER_LAMBDA_P (name) = true; - { - /* Unique name. This is just like an unnamed class, but we cannot use - make_anon_name because of certain checks against TYPE_UNNAMED_P. */ - tree name; - name = make_lambda_name (); - - /* Create the new RECORD_TYPE for this lambda. */ - type = xref_tag (/*tag_code=*/record_type, - name, - /*scope=*/ts_lambda, - /*template_header_p=*/false); - if (type == error_mark_node) - return error_mark_node; - } + /* Create the new RECORD_TYPE for this lambda. */ + tree type = xref_tag (/*tag_code=*/record_type, name, + /*scope=*/ts_lambda, /*template_header_p=*/false); + if (type == error_mark_node) + return error_mark_node; /* Designate it as a struct so that we can use aggregate initialization. */ CLASSTYPE_DECLARED_CLASS (type) = false; -- cgit v1.1