diff options
author | Nathan Sidwell <nathan@acm.org> | 2019-05-31 13:25:46 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2019-05-31 13:25:46 +0000 |
commit | ca3edeaed691cf971ebdf7768f5d73b182c1aa07 (patch) | |
tree | 70d2c9af2fdf1addd53538a38013476747599eca /gcc/cp/lambda.c | |
parent | 929c046d575c273e80000310b88c24af94cc4cf8 (diff) | |
download | gcc-ca3edeaed691cf971ebdf7768f5d73b182c1aa07.zip gcc-ca3edeaed691cf971ebdf7768f5d73b182c1aa07.tar.gz gcc-ca3edeaed691cf971ebdf7768f5d73b182c1aa07.tar.bz2 |
[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
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r-- | gcc/cp/lambda.c | 23 |
1 files changed, 8 insertions, 15 deletions
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; |