summaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2017-07-21 00:27:51 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2017-07-21 00:27:51 +0000
commitab87ee8f509c0b600102195704105d4d98ec59d9 (patch)
tree9eb091e90a6d0a753271dc34499ed1179b3527ca /gcc/cp/pt.c
parent8a6284fd1706b5f44a29ae0cbdb30c712a83dbab (diff)
downloadgcc-ab87ee8f509c0b600102195704105d4d98ec59d9.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250413 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c90
1 files changed, 39 insertions, 51 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index da133bd1863..bb323534ec0 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10551,7 +10551,6 @@ instantiate_class_template_1 (tree type)
}
else if (DECL_DECLARES_FUNCTION_P (t))
{
- /* Build new TYPE_METHODS. */
tree r;
if (TREE_CODE (t) == TEMPLATE_DECL)
@@ -16137,13 +16136,15 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
instantiated along with their containing function. And this
way we don't have to deal with pushing out of one local class
to instantiate a member of another local class. */
- tree fn;
/* Closures are handled by the LAMBDA_EXPR. */
gcc_assert (!LAMBDA_TYPE_P (TREE_TYPE (t)));
complete_type (tmp);
- for (fn = TYPE_METHODS (tmp); fn; fn = DECL_CHAIN (fn))
- if (!DECL_ARTIFICIAL (fn))
- instantiate_decl (fn, /*defer_ok=*/false,
+ for (tree fld = TYPE_FIELDS (tmp); fld; fld = DECL_CHAIN (fld))
+ if ((VAR_P (fld)
+ || (TREE_CODE (fld) == FUNCTION_DECL
+ && !DECL_ARTIFICIAL (fld)))
+ && DECL_TEMPLATE_INSTANTIATION (fld))
+ instantiate_decl (fld, /*defer_ok=*/false,
/*expl_inst_class=*/false);
}
break;
@@ -22133,18 +22134,6 @@ bt_instantiate_type_proc (binding_entry entry, void *data)
do_type_instantiation (TYPE_MAIN_DECL (entry->type), storage, 0);
}
-/* Called from do_type_instantiation to instantiate a member
- (a member function or a static member variable) of an
- explicitly instantiated class template. */
-static void
-instantiate_class_member (tree decl, int extern_p)
-{
- mark_decl_instantiated (decl, extern_p);
- if (! extern_p)
- instantiate_decl (decl, /*defer_ok=*/true,
- /*expl_inst_class_mem_p=*/true);
-}
-
/* Perform an explicit instantiation of template class T. STORAGE, if
non-null, is the RID for extern, inline or static. COMPLAIN is
nonzero if this is called from the parser, zero if called recursively,
@@ -22254,12 +22243,9 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
if (nomem_p)
return;
- {
- tree tmp;
-
- /* In contrast to implicit instantiation, where only the
- declarations, and not the definitions, of members are
- instantiated, we have here:
+ /* In contrast to implicit instantiation, where only the
+ declarations, and not the definitions, of members are
+ instantiated, we have here:
[temp.explicit]
@@ -22268,27 +22254,28 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
previously explicitly specialized in the translation unit
containing the explicit instantiation.
- Of course, we can't instantiate member template classes, since
- we don't have any arguments for them. Note that the standard
- is unclear on whether the instantiation of the members are
- *explicit* instantiations or not. However, the most natural
- interpretation is that it should be an explicit instantiation. */
-
- if (! static_p)
- for (tmp = TYPE_METHODS (t); tmp; tmp = DECL_CHAIN (tmp))
- if (TREE_CODE (tmp) == FUNCTION_DECL
- && DECL_TEMPLATE_INSTANTIATION (tmp)
- && user_provided_p (tmp))
- instantiate_class_member (tmp, extern_p);
-
- for (tmp = TYPE_FIELDS (t); tmp; tmp = DECL_CHAIN (tmp))
- if (VAR_P (tmp) && DECL_TEMPLATE_INSTANTIATION (tmp))
- instantiate_class_member (tmp, extern_p);
-
- if (CLASSTYPE_NESTED_UTDS (t))
- binding_table_foreach (CLASSTYPE_NESTED_UTDS (t),
- bt_instantiate_type_proc, &storage);
- }
+ Of course, we can't instantiate member template classes, since we
+ don't have any arguments for them. Note that the standard is
+ unclear on whether the instantiation of the members are
+ *explicit* instantiations or not. However, the most natural
+ interpretation is that it should be an explicit
+ instantiation. */
+ for (tree fld = TYPE_FIELDS (t); fld; fld = DECL_CHAIN (fld))
+ if ((VAR_P (fld)
+ || (TREE_CODE (fld) == FUNCTION_DECL
+ && !static_p
+ && user_provided_p (fld)))
+ && DECL_TEMPLATE_INSTANTIATION (fld))
+ {
+ mark_decl_instantiated (fld, extern_p);
+ if (! extern_p)
+ instantiate_decl (fld, /*defer_ok=*/true,
+ /*expl_inst_class_mem_p=*/true);
+ }
+
+ if (CLASSTYPE_NESTED_UTDS (t))
+ binding_table_foreach (CLASSTYPE_NESTED_UTDS (t),
+ bt_instantiate_type_proc, &storage);
}
/* Given a function DECL, which is a specialization of TMPL, modify
@@ -23080,19 +23067,20 @@ instantiate_pending_templates (int retries)
if (TYPE_P (instantiation))
{
- tree fn;
-
if (!COMPLETE_TYPE_P (instantiation))
{
instantiate_class_template (instantiation);
if (CLASSTYPE_TEMPLATE_INSTANTIATION (instantiation))
- for (fn = TYPE_METHODS (instantiation);
- fn;
- fn = TREE_CHAIN (fn))
- if (! DECL_ARTIFICIAL (fn))
- instantiate_decl (fn,
+ for (tree fld = TYPE_FIELDS (instantiation);
+ fld; fld = TREE_CHAIN (fld))
+ if ((VAR_P (fld)
+ || (TREE_CODE (fld) == FUNCTION_DECL
+ && !DECL_ARTIFICIAL (fld)))
+ && DECL_TEMPLATE_INSTANTIATION (fld))
+ instantiate_decl (fld,
/*defer_ok=*/false,
/*expl_inst_class_mem_p=*/false);
+
if (COMPLETE_TYPE_P (instantiation))
reconsider = 1;
}