aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/lambda.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-09-24 12:50:29 -0700
committerNathan Sidwell <nathan@acm.org>2020-09-24 12:56:59 -0700
commitd13c0ae859fbb5bb937692548e5860e4cb39e26b (patch)
treea626f5797c0268417dbd9864fe484c1b06c0a1fc /gcc/cp/lambda.c
parent6b6c89b37bc26791943ea79191891e77591de2b8 (diff)
downloadgcc-d13c0ae859fbb5bb937692548e5860e4cb39e26b.zip
gcc-d13c0ae859fbb5bb937692548e5860e4cb39e26b.tar.gz
gcc-d13c0ae859fbb5bb937692548e5860e4cb39e26b.tar.bz2
c++: Cleanup some decl pushing apis
In cleaning up local decl handling, here's an initial patch that takes advantage of C++'s default args for the is_friend parm of pushdecl, duplicate_decls and push_template_decl_real and the scope & tpl_header parms of xref_tag. Then many of the calls simply not mention these. I also rename push_template_decl_real to push_template_decl, deleting the original forwarding function. This'll make my later patches changing their types less intrusive. There are 2 functional changes: 1) push_template_decl requires is_friend to be correct, it doesn't go checking for a friend function (an assert is added). 2) debug_overload prints out Hidden and Using markers for the overload set. gcc/cp/ * cp-tree.h (duplicate_decls): Default is_friend to false. (xref_tag): Default tag_scope & tpl_header_p to ts_current & false. (push_template_decl_real): Default is_friend to false. Rename to ... (push_template_decl): ... here. Delete original decl. * name-lookup.h (pushdecl_namespace_level): Default is_friend to false. (pushtag): Default tag_scope to ts_current. * coroutines.cc (morph_fn_to_coro): Drop default args to xref_tag. * decl.c (start_decl): Drop default args to duplicate_decls. (start_enum): Drop default arg to pushtag & xref_tag. (start_preparsed_function): Pass DECL_FRIEND_P to push_template_decl. (grokmethod): Likewise. * friend.c (do_friend): Rename push_template_decl_real calls. * lambda.c (begin_lamnbda_type): Drop default args to xref_tag. (vla_capture_type): Likewise. * name-lookup.c (maybe_process_template_type_declaration): Rename push_template_decl_real call. (pushdecl_top_level_and_finish): Drop default arg to pushdecl_namespace_level. * pt.c (push_template_decl_real): Assert no surprising friend functions. Rename to ... (push_template_decl): ... here. Delete original function. (lookup_template_class_1): Drop default args from pushtag. (instantiate_class_template_1): Likewise. * ptree.c (debug_overload): Print hidden and using markers. * rtti.c (init_rtti_processing): Drop refault args from xref_tag. (build_dynamic_cast_1, tinfo_base_init): Likewise. * semantics.c (begin_class_definition): Drop default args to pushtag. gcc/objcp/ * objcp-decl.c (objcp_start_struct): Drop default args to xref_tag. (objcp_xref_tag): Likewise. libcc1/ * libcp1plugin.cc (supplement_binding): Drop default args to duplicate_decls. (safe_pushtag): Drop scope parm. Drop default args to pushtag. (safe_pushdecl_maybe_friend): Rename to ... (safe_pushdecl): ... here. Drop is_friend parm. Drop default args to pushdecl. (plugin_build_decl): Adjust safe_pushdecl & safe_pushtag calls. (plugin_build_constant): Adjust safe_pushdecl call.
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r--gcc/cp/lambda.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 7fccccc..07a5401 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -134,8 +134,7 @@ begin_lambda_type (tree lambda)
IDENTIFIER_LAMBDA_P (name) = true;
/* Create the new RECORD_TYPE for this lambda. */
- tree type = xref_tag (/*tag_code=*/record_type, name,
- /*scope=*/ts_current, /*template_header_p=*/false);
+ tree type = xref_tag (/*tag_code=*/record_type, name);
if (type == error_mark_node)
return error_mark_node;
@@ -476,7 +475,7 @@ static GTY(()) tree max_id;
static tree
vla_capture_type (tree array_type)
{
- tree type = xref_tag (record_type, make_anon_name (), ts_current, false);
+ tree type = xref_tag (record_type, make_anon_name ());
xref_basetypes (type, NULL_TREE);
type = begin_class_definition (type);
if (!ptr_id)