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.
This commit is contained in:
Nathan Sidwell 2020-09-21 08:55:15 -07:00
parent 4f5a297f75
commit 33605e9bef
3 changed files with 15 additions and 21 deletions

View File

@ -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
{

View File

@ -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;

View File

@ -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 {