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 /libcc1 | |
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 'libcc1')
-rw-r--r-- | libcc1/libcp1plugin.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc index c8b3011..279bb84 100644 --- a/libcc1/libcp1plugin.cc +++ b/libcc1/libcp1plugin.cc @@ -407,7 +407,7 @@ supplement_binding (cxx_binding *binding, tree decl) && DECL_EXTERNAL (target_decl) && DECL_EXTERNAL (target_bval) && !DECL_CLASS_SCOPE_P (target_decl)) { - duplicate_decls (decl, binding->value, /*newdecl_is_friend=*/false); + duplicate_decls (decl, binding->value); ok = false; } else if (TREE_CODE (decl) == NAMESPACE_DECL @@ -785,14 +785,14 @@ safe_push_template_decl (tree decl) } static inline tree -safe_pushtag (tree name, tree type, tag_scope scope) +safe_pushtag (tree name, tree type) { void (*save_oracle) (enum cp_oracle_request, tree identifier); save_oracle = cp_binding_oracle; cp_binding_oracle = NULL; - tree ret = pushtag (name, type, scope); + tree ret = pushtag (name, type); cp_binding_oracle = save_oracle; @@ -800,14 +800,14 @@ safe_pushtag (tree name, tree type, tag_scope scope) } static inline tree -safe_pushdecl_maybe_friend (tree decl, bool is_friend) +safe_pushdecl (tree decl) { void (*save_oracle) (enum cp_oracle_request, tree identifier); save_oracle = cp_binding_oracle; cp_binding_oracle = NULL; - tree ret = pushdecl (decl, is_friend); + tree ret = pushdecl (decl); cp_binding_oracle = save_oracle; @@ -1514,7 +1514,7 @@ plugin_build_decl (cc1_plugin::connection *self, if (template_decl_p) { if (RECORD_OR_UNION_CODE_P (code)) - safe_pushtag (identifier, TREE_TYPE (decl), ts_current); + safe_pushtag (identifier, TREE_TYPE (decl)); else decl = safe_push_template_decl (decl); @@ -1533,11 +1533,11 @@ plugin_build_decl (cc1_plugin::connection *self, finish_member_declaration (tdecl); } else if (RECORD_OR_UNION_CODE_P (code)) - safe_pushtag (identifier, TREE_TYPE (decl), ts_current); + safe_pushtag (identifier, TREE_TYPE (decl)); else if (class_member_p) finish_member_declaration (decl); else - decl = safe_pushdecl_maybe_friend (decl, false); + decl = safe_pushdecl (decl); if ((ctor || dtor) /* Don't crash after a duplicate declaration of a cdtor. */ @@ -3608,7 +3608,7 @@ plugin_build_constant (cc1_plugin::connection *self, gcc_type type_in, TREE_STATIC (decl) = 1; TREE_READONLY (decl) = 1; cp_finish_decl (decl, cst, true, NULL, LOOKUP_ONLYCONVERTING); - safe_pushdecl_maybe_friend (decl, false); + safe_pushdecl (decl); return 1; } |