diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-09-24 12:50:29 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-09-24 12:56:59 -0700 |
commit | d13c0ae859fbb5bb937692548e5860e4cb39e26b (patch) | |
tree | a626f5797c0268417dbd9864fe484c1b06c0a1fc /gcc/cp/rtti.c | |
parent | 6b6c89b37bc26791943ea79191891e77591de2b8 (diff) | |
download | gcc-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/rtti.c')
-rw-r--r-- | gcc/cp/rtti.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 0ab3c42..7c4bff7 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -169,8 +169,7 @@ init_rtti_processing (void) tree type_info_type; push_nested_namespace (std_node); - type_info_type = xref_tag (class_type, get_identifier ("type_info"), - /*tag_scope=*/ts_current, false); + type_info_type = xref_tag (class_type, get_identifier ("type_info")); pop_nested_namespace (std_node); const_type_info_type_node = cp_build_qualified_type (type_info_type, TYPE_QUAL_CONST); @@ -761,9 +760,7 @@ build_dynamic_cast_1 (location_t loc, tree type, tree expr, push_abi_namespace (); tinfo_ptr = xref_tag (class_type, - get_identifier ("__class_type_info"), - /*tag_scope=*/ts_current, false); - + get_identifier ("__class_type_info")); tinfo_ptr = build_pointer_type (cp_build_qualified_type (tinfo_ptr, TYPE_QUAL_CONST)); @@ -948,10 +945,8 @@ tinfo_base_init (tinfo_s *ti, tree target) vtable_ptr = ti->vtable; if (!vtable_ptr) { - tree real_type; push_abi_namespace (); - real_type = xref_tag (class_type, ti->name, - /*tag_scope=*/ts_current, false); + tree real_type = xref_tag (class_type, ti->name); pop_abi_namespace (); if (!COMPLETE_TYPE_P (real_type)) |