From: Nathan Sidwell Date: Mon, 21 Sep 2020 15:55:15 +0000 (-0700) Subject: c++: ts_lambda is not needed X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=33605e9bef15555b19f06424ea0b777b5fdc0dfa;p=gcc.git c++: ts_lambda is not needed We don't need ts_lambda, as IDENTIFIER_LAMBDA_P is sufficient. Killed thusly. gcc/cp/ * decl.c (xref_tag_1): Use IDENTIFIER_LAMBDA_P to detect lambdas. * lambda.c (begin_lambda_type): Use ts_current to push the tag. * name-lookup.h (enum tag_scope): Drop ts_lambda. --- diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index af796499df7..bbecebe7a62 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -14857,10 +14857,10 @@ check_elaborated_type_specifier (enum tag_types tag_code, return type; } -/* Lookup NAME in elaborate type specifier in scope according to - SCOPE and issue diagnostics if necessary. - Return *_TYPE node upon success, NULL_TREE when the NAME is not - found, and ERROR_MARK_NODE for type error. */ +/* Lookup NAME of an elaborated type specifier according to SCOPE and + issue diagnostics if necessary. Return *_TYPE node upon success, + NULL_TREE when the NAME is not found, and ERROR_MARK_NODE for type + error. */ static tree lookup_and_check_tag (enum tag_types tag_code, tree name, @@ -14997,9 +14997,9 @@ xref_tag_1 (enum tag_types tag_code, tree name, /* In case of anonymous name, xref_tag is only called to make type node and push name. Name lookup is not required. */ tree t = NULL_TREE; - if (scope != ts_lambda && !IDENTIFIER_ANON_P (name)) + if (!IDENTIFIER_ANON_P (name)) t = lookup_and_check_tag (tag_code, name, scope, template_header_p); - + if (t == error_mark_node) return error_mark_node; @@ -15052,19 +15052,14 @@ xref_tag_1 (enum tag_types tag_code, tree name, error ("use of enum %q#D without previous declaration", name); return error_mark_node; } - else - { - t = make_class_type (code); - TYPE_CONTEXT (t) = context; - if (scope == ts_lambda) - { - /* Mark it as a lambda type. */ - CLASSTYPE_LAMBDA_EXPR (t) = error_mark_node; - /* And push it into current scope. */ - scope = ts_current; - } - t = pushtag (name, t, scope); - } + + t = make_class_type (code); + TYPE_CONTEXT (t) = context; + if (IDENTIFIER_LAMBDA_P (name)) + /* Mark it as a lambda type right now. Our caller will + correct the value. */ + CLASSTYPE_LAMBDA_EXPR (t) = error_mark_node; + t = pushtag (name, t, scope); } else { diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index c94fe8edb8e..364a3e9f6b9 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -135,7 +135,7 @@ begin_lambda_type (tree lambda) /* Create the new RECORD_TYPE for this lambda. */ tree type = xref_tag (/*tag_code=*/record_type, name, - /*scope=*/ts_lambda, /*template_header_p=*/false); + /*scope=*/ts_current, /*template_header_p=*/false); if (type == error_mark_node) return error_mark_node; diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h index 723fbb0008c..a0815e1a0ac 100644 --- a/gcc/cp/name-lookup.h +++ b/gcc/cp/name-lookup.h @@ -139,7 +139,6 @@ enum tag_scope { only, for friend class lookup according to [namespace.memdef]/3 and [class.friend]/9. */ - ts_lambda = 3 /* Declaring a lambda closure. */ }; struct GTY(()) cp_class_binding {