aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-09-21 08:55:15 -0700
committerNathan Sidwell <nathan@acm.org>2020-09-21 11:53:14 -0700
commit33605e9bef15555b19f06424ea0b777b5fdc0dfa (patch)
tree4dfd124ac2f9b0f3e404605ac5223cb8eea2f061
parent4f5a297f7520cf5ba10a3a16f32ea0e1655b203f (diff)
downloadgcc-33605e9bef15555b19f06424ea0b777b5fdc0dfa.zip
gcc-33605e9bef15555b19f06424ea0b777b5fdc0dfa.tar.gz
gcc-33605e9bef15555b19f06424ea0b777b5fdc0dfa.tar.bz2
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.
-rw-r--r--gcc/cp/decl.c33
-rw-r--r--gcc/cp/lambda.c2
-rw-r--r--gcc/cp/name-lookup.h1
3 files changed, 15 insertions, 21 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index af79649..bbecebe 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 c94fe8e..364a3e9 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 723fbb0..a0815e1 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 {