From 5aaa8fb40681ee66282d73dab8c8eccbf5ee0518 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 21 Jul 2017 00:27:51 +0000 Subject: Remove TYPE_METHODS. gcc/ Remove TYPE_METHODS. * tree.h (TYPE_METHODS): Delete. * dwarf2out.c (gen_member_die): Member fns are on TYPE_FIELDS. * dbxout.c (dbxout_type_fields): Ignore FUNCTION_DECLs. (dbxout_type_methods): Scan TYPE_FIELDS. (dbxout_type): Don't check TYPE_METHODS here. * function.c (use_register_for_decl): Always ignore register for class types when not optimizing. * ipa-devirt.c (odr_types_equivalent_p): Delete TYPE_METHODS scan. * tree.c (free_lang_data_in_type): Stitch out member functions and templates from TYPE_FIELDS. (build_distinct_type_copy, verify_type_variant, verify_type): Member fns are on TYPE_FIELDS. * tree-dump.c (dequeue_and_dump): No TYPE_METHODS. * tree-pretty-print.c (dump_generic_node): Likewise. gcc/cp/ Remove TYPE_METHODS. * class.c (maybe_warn_about_overly_private_class, finish_struct_methods, one_inheriting_sig, count_fields, add_fields_to_record_type, check_field_decls, check_methods, clone_function_decl, set_method_tm_attributes, finalize_literal_type_property, check_bases_and_members, create_vtable_ptr, determine_key_method, unreverse_member_declarations, finish_struct, add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS. * decl.c (fixup_anonymous_aggr): Likewise. * decl2.c (reset_type_linkage_2): Likewise. * method.c (after_nsdmi_defaulted_late_checks, lazily_declare_fn): Likewise. * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise. * pt.c (instantiate_class_template_1, tsubst_expr, do_type_instantiation, instantiate_pending_templates): Likewise. * search.c (lookup_field_1): Likewise. * semantics.c (finish_member_declaration, finish_omp_declare_simd_methods): Likewise. gcc/c-family/ Remove TYPE_METHODS. * c-ada-spec.c (is_tagged_type, has_nontrivial_methods, dump_ada_template, print_ada_methods, print_ada_declaration): Member fns are on TYPE_FIELDS. gcc/objc/ Remove TYPE_METHODS. * objc-runtime-shared-support.c (build_ivar_list_initializer): Don't presume first item is a FIELD_DECL. gcc/testsuite/ * g++.dg/ext/anon-struct6.C: Adjust diag. * g++.old-deja/g++.other/anon4.C: Adjust diag. libcc1/ Remove TYPE_METHODS. * libcp1plugin.cc (plugin_build_decl): Member fns are on TYPE_FIELDS. From-SVN: r250413 --- gcc/cp/decl2.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'gcc/cp/decl2.c') diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 4fa4ad9..2a52f8c 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2592,6 +2592,7 @@ reset_decl_linkage (tree decl) determine_visibility (decl); tentative_decl_linkage (decl); } + static void reset_type_linkage_2 (tree type) { @@ -2615,18 +2616,14 @@ reset_type_linkage_2 (tree type) for (tree m = TYPE_FIELDS (type); m; m = DECL_CHAIN (m)) { tree mem = STRIP_TEMPLATE (m); - if (VAR_P (mem)) + if (TREE_CODE (mem) == VAR_DECL || TREE_CODE (mem) == FUNCTION_DECL) reset_decl_linkage (mem); } - for (tree m = TYPE_METHODS (type); m; m = DECL_CHAIN (m)) - { - tree mem = STRIP_TEMPLATE (m); - reset_decl_linkage (mem); - } binding_table_foreach (CLASSTYPE_NESTED_UTDS (type), bt_reset_linkage_2, NULL); } } + static void bt_reset_linkage_2 (binding_entry b, void */*data*/) { @@ -4997,19 +4994,13 @@ mark_used (tree decl, tsubst_flags_t complain) if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DELETED_FN (decl)) { - if (DECL_ARTIFICIAL (decl)) - { - if (DECL_OVERLOADED_OPERATOR_P (decl) == TYPE_EXPR - && LAMBDA_TYPE_P (DECL_CONTEXT (decl))) - { - /* We mark a lambda conversion op as deleted if we can't - generate it properly; see maybe_add_lambda_conv_op. */ - sorry ("converting lambda which uses %<...%> to " - "function pointer"); - return false; - } - } - if (complain & tf_error) + if (DECL_ARTIFICIAL (decl) + && DECL_OVERLOADED_OPERATOR_P (decl) == TYPE_EXPR + && LAMBDA_TYPE_P (DECL_CONTEXT (decl))) + /* We mark a lambda conversion op as deleted if we can't + generate it properly; see maybe_add_lambda_conv_op. */ + sorry ("converting lambda which uses %<...%> to function pointer"); + else if (complain & tf_error) { error ("use of deleted function %qD", decl); if (!maybe_explain_implicit_delete (decl)) -- cgit v1.1