mirror of git://gcc.gnu.org/git/gcc.git
class.c (check_methods, [...]): Guard VINDEX checks by FUNCTION_DECL check.
* class.c (check_methods, create_vtable_ptr, determine_key_method, add_vcall_offset_vtbl_entries_1): Guard VINDEX checks by FUNCTION_DECL check. * cp-tree.h (lang_decl_ns): Add ns_using and ns_users. (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): Use lang_decl_ns. (DECL_NAMESPACE_ASSOCIATIONS): Use DECL_INITIAL. (DECL_TEMPLATE_INSTANTIATIONS): Use DECL_SIZE_UNIT. * tree.c (find_decls_types_r): Do not check DECL_VINDEX for TYPE_DECL. * tree.h (DECL_VINDEX, DECL_SAVED_TREE): Restrict to DECL_FUNCTION. * tree-core.h (tree_decl_non_common): Move saved_tree and vindex... (tree_function_decl): ... here. * tree-streamer-out.c (write_ts_decl_non_common_tree_pointers): Move streaming of vindex to ... (write_ts_function_decl_tree_pointers): ... here. * tree-streamer-in.c (lto_input_ts_decl_non_common_tree_pointers): Do not stream DECL_VINDEX. (lto_input_ts_function_decl_tree_pointers): Stream it here. * lto.c (mentions_vars_p_decl_non_common): Move DECL_VINDEX check to .. (mentions_vars_p_function): ... here. (compare_tree_sccs_1): Update VINDEX checks. (lto_fixup_prevailing_decls): Likewise. From-SVN: r211960
This commit is contained in:
parent
ecc6304308
commit
aaf8a23ef3
|
|
@ -1,3 +1,16 @@
|
|||
2014-06-24 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
* tree.c (find_decls_types_r): Do not check DECL_VINDEX for TYPE_DECL.
|
||||
* tree.h (DECL_VINDEX, DECL_SAVED_TREE): Restrict to DECL_FUNCTION.
|
||||
* tree-core.h (tree_decl_non_common): Move saved_tree and vindex...
|
||||
(tree_function_decl): ... here.
|
||||
* tree-streamer-out.c (write_ts_decl_non_common_tree_pointers): Move
|
||||
streaming of vindex to ...
|
||||
(write_ts_function_decl_tree_pointers): ... here.
|
||||
* tree-streamer-in.c (lto_input_ts_decl_non_common_tree_pointers):
|
||||
Do not stream DECL_VINDEX.
|
||||
(lto_input_ts_function_decl_tree_pointers): Stream it here.
|
||||
|
||||
2014-06-24 Catherine Moore <clm@codesourcery.com>
|
||||
Sandra Loosemore <sandra@codesourcery.com>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
2014-06-24 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
* class.c (check_methods, create_vtable_ptr, determine_key_method,
|
||||
add_vcall_offset_vtbl_entries_1): Guard VINDEX checks by FUNCTION_DECL check.
|
||||
* cp-tree.h (lang_decl_ns): Add ns_using and ns_users.
|
||||
(DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): Use lang_decl_ns.
|
||||
(DECL_NAMESPACE_ASSOCIATIONS): Use DECL_INITIAL.
|
||||
(DECL_TEMPLATE_INSTANTIATIONS): Use DECL_SIZE_UNIT.
|
||||
|
||||
2014-06-24 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/33972
|
||||
|
|
|
|||
|
|
@ -4356,11 +4356,11 @@ check_methods (tree t)
|
|||
for (x = TYPE_METHODS (t); x; x = DECL_CHAIN (x))
|
||||
{
|
||||
check_for_override (x, t);
|
||||
if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
|
||||
if (DECL_PURE_VIRTUAL_P (x) && (TREE_CODE (x) != FUNCTION_DECL || ! DECL_VINDEX (x)))
|
||||
error ("initializer specified for non-virtual method %q+D", x);
|
||||
/* The name of the field is the original field name
|
||||
Save this in auxiliary field for later overloading. */
|
||||
if (DECL_VINDEX (x))
|
||||
if (TREE_CODE (x) == FUNCTION_DECL && DECL_VINDEX (x))
|
||||
{
|
||||
TYPE_POLYMORPHIC_P (t) = 1;
|
||||
if (DECL_PURE_VIRTUAL_P (x))
|
||||
|
|
@ -5658,7 +5658,8 @@ create_vtable_ptr (tree t, tree* virtuals_p)
|
|||
|
||||
/* Collect the virtual functions declared in T. */
|
||||
for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn))
|
||||
if (DECL_VINDEX (fn) && !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn)
|
||||
if (TREE_CODE (fn) == FUNCTION_DECL
|
||||
&& DECL_VINDEX (fn) && !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn)
|
||||
&& TREE_CODE (DECL_VINDEX (fn)) != INTEGER_CST)
|
||||
{
|
||||
tree new_virtual = make_node (TREE_LIST);
|
||||
|
|
@ -6327,7 +6328,8 @@ determine_key_method (tree type)
|
|||
this function until the end of the translation unit. */
|
||||
for (method = TYPE_METHODS (type); method != NULL_TREE;
|
||||
method = DECL_CHAIN (method))
|
||||
if (DECL_VINDEX (method) != NULL_TREE
|
||||
if (TREE_CODE (method) == FUNCTION_DECL
|
||||
&& DECL_VINDEX (method) != NULL_TREE
|
||||
&& ! DECL_DECLARED_INLINE_P (method)
|
||||
&& ! DECL_PURE_VIRTUAL_P (method))
|
||||
{
|
||||
|
|
@ -9140,7 +9142,7 @@ add_vcall_offset_vtbl_entries_1 (tree binfo, vtbl_init_data* vid)
|
|||
for (orig_fn = TYPE_METHODS (BINFO_TYPE (binfo));
|
||||
orig_fn;
|
||||
orig_fn = DECL_CHAIN (orig_fn))
|
||||
if (DECL_VINDEX (orig_fn))
|
||||
if (TREE_CODE (orig_fn) == FUNCTION_DECL && DECL_VINDEX (orig_fn))
|
||||
add_vcall_offset (orig_fn, binfo, vid);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2048,6 +2048,8 @@ struct GTY(()) lang_decl_fn {
|
|||
struct GTY(()) lang_decl_ns {
|
||||
struct lang_decl_base base;
|
||||
cp_binding_level *level;
|
||||
tree ns_using;
|
||||
tree ns_users;
|
||||
};
|
||||
|
||||
/* DECL_LANG_SPECIFIC for parameters. */
|
||||
|
|
@ -2580,16 +2582,16 @@ struct GTY(()) lang_decl {
|
|||
/* For a NAMESPACE_DECL: the list of using namespace directives
|
||||
The PURPOSE is the used namespace, the value is the namespace
|
||||
that is the common ancestor. */
|
||||
#define DECL_NAMESPACE_USING(NODE) DECL_VINDEX (NAMESPACE_DECL_CHECK (NODE))
|
||||
#define DECL_NAMESPACE_USING(NODE) (LANG_DECL_NS_CHECK (NODE)->ns_using)
|
||||
|
||||
/* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
|
||||
of a namespace, to record the transitive closure of using namespace. */
|
||||
#define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE))
|
||||
#define DECL_NAMESPACE_USERS(NODE) (LANG_DECL_NS_CHECK (NODE)->ns_users)
|
||||
|
||||
/* In a NAMESPACE_DECL, the list of namespaces which have associated
|
||||
themselves with this one. */
|
||||
#define DECL_NAMESPACE_ASSOCIATIONS(NODE) \
|
||||
(NAMESPACE_DECL_CHECK (NODE)->decl_non_common.saved_tree)
|
||||
DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE))
|
||||
|
||||
/* In a NAMESPACE_DECL, points to the original namespace if this is
|
||||
a namespace alias. */
|
||||
|
|
@ -3784,7 +3786,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
|
|||
|
||||
This list is not used for other templates. */
|
||||
#define DECL_TEMPLATE_INSTANTIATIONS(NODE) \
|
||||
DECL_VINDEX (TEMPLATE_DECL_CHECK (NODE))
|
||||
DECL_SIZE_UNIT (TEMPLATE_DECL_CHECK (NODE))
|
||||
|
||||
/* For a class template, this list contains the partial
|
||||
specializations of this template. (Full specializations are not
|
||||
|
|
|
|||
|
|
@ -528,7 +528,6 @@ DFS_write_tree_body (struct output_block *ob,
|
|||
{
|
||||
if (TREE_CODE (expr) == TYPE_DECL)
|
||||
DFS_follow_tree_edge (DECL_ORIGINAL_TYPE (expr));
|
||||
DFS_follow_tree_edge (DECL_VINDEX (expr));
|
||||
}
|
||||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
|
||||
|
|
@ -549,6 +548,7 @@ DFS_write_tree_body (struct output_block *ob,
|
|||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
|
||||
{
|
||||
DFS_follow_tree_edge (DECL_VINDEX (expr));
|
||||
DFS_follow_tree_edge (DECL_FUNCTION_PERSONALITY (expr));
|
||||
/* Do not DECL_FUNCTION_SPECIFIC_TARGET. They will be regenerated. */
|
||||
DFS_follow_tree_edge (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr));
|
||||
|
|
@ -961,7 +961,6 @@ hash_tree (struct streamer_tree_cache_d *cache, tree t)
|
|||
{
|
||||
if (code == TYPE_DECL)
|
||||
visit (DECL_ORIGINAL_TYPE (t));
|
||||
visit (DECL_VINDEX (t));
|
||||
}
|
||||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
|
||||
|
|
@ -981,6 +980,7 @@ hash_tree (struct streamer_tree_cache_d *cache, tree t)
|
|||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
|
||||
{
|
||||
visit (DECL_VINDEX (t));
|
||||
visit (DECL_FUNCTION_PERSONALITY (t));
|
||||
/* Do not follow DECL_FUNCTION_SPECIFIC_TARGET. */
|
||||
visit (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (t));
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
2014-06-24 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
* lto.c (mentions_vars_p_decl_non_common): Move DECL_VINDEX check to ..
|
||||
(mentions_vars_p_function): ... here.
|
||||
(compare_tree_sccs_1): Update VINDEX checks.
|
||||
(lto_fixup_prevailing_decls): Likewise.
|
||||
|
||||
2014-06-24 Trevor Saunders <tsaunders@mozilla.com>
|
||||
|
||||
* lto.c (canonical_type_hash_cache): Use hash_map instead of
|
||||
|
|
|
|||
|
|
@ -777,7 +777,6 @@ mentions_vars_p_decl_non_common (tree t)
|
|||
return true;
|
||||
CHECK_NO_VAR (DECL_ARGUMENT_FLD (t));
|
||||
CHECK_NO_VAR (DECL_RESULT_FLD (t));
|
||||
CHECK_NO_VAR (DECL_VINDEX (t));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -788,6 +787,7 @@ mentions_vars_p_function (tree t)
|
|||
{
|
||||
if (mentions_vars_p_decl_non_common (t))
|
||||
return true;
|
||||
CHECK_NO_VAR (DECL_VINDEX (t));
|
||||
CHECK_VAR (DECL_FUNCTION_PERSONALITY (t));
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1512,7 +1512,6 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map)
|
|||
}
|
||||
else if (code == TYPE_DECL)
|
||||
compare_tree_edges (DECL_ORIGINAL_TYPE (t1), DECL_ORIGINAL_TYPE (t2));
|
||||
compare_tree_edges (DECL_VINDEX (t1), DECL_VINDEX (t2));
|
||||
}
|
||||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
|
||||
|
|
@ -1538,6 +1537,7 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map)
|
|||
{
|
||||
compare_tree_edges (DECL_FUNCTION_PERSONALITY (t1),
|
||||
DECL_FUNCTION_PERSONALITY (t2));
|
||||
compare_tree_edges (DECL_VINDEX (t1), DECL_VINDEX (t2));
|
||||
/* DECL_FUNCTION_SPECIFIC_TARGET is not yet created. We compare
|
||||
the attribute list instead. */
|
||||
compare_tree_edges (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (t1),
|
||||
|
|
@ -2714,10 +2714,12 @@ lto_fixup_prevailing_decls (tree t)
|
|||
{
|
||||
LTO_NO_PREVAIL (DECL_ARGUMENT_FLD (t));
|
||||
LTO_NO_PREVAIL (DECL_RESULT_FLD (t));
|
||||
LTO_NO_PREVAIL (DECL_VINDEX (t));
|
||||
}
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
|
||||
{
|
||||
LTO_SET_PREVAIL (DECL_FUNCTION_PERSONALITY (t));
|
||||
LTO_NO_PREVAIL (DECL_VINDEX (t));
|
||||
}
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_FIELD_DECL))
|
||||
{
|
||||
LTO_SET_PREVAIL (DECL_FIELD_OFFSET (t));
|
||||
|
|
|
|||
|
|
@ -1494,14 +1494,10 @@ struct GTY(()) tree_var_decl {
|
|||
|
||||
struct GTY(()) tree_decl_non_common {
|
||||
struct tree_decl_with_vis common;
|
||||
/* C++ uses this in namespaces. */
|
||||
tree saved_tree;
|
||||
/* C++ uses this in templates. */
|
||||
tree arguments;
|
||||
/* Almost all FE's use this. */
|
||||
tree result;
|
||||
/* C++ uses this in namespaces and function_decls. */
|
||||
tree vindex;
|
||||
};
|
||||
|
||||
/* FUNCTION_DECL inherits from DECL_NON_COMMON because of the use of the
|
||||
|
|
@ -1521,6 +1517,11 @@ struct GTY(()) tree_function_decl {
|
|||
tree function_specific_target; /* target options */
|
||||
tree function_specific_optimization; /* optimization options */
|
||||
|
||||
/* Generic function body. */
|
||||
tree saved_tree;
|
||||
/* Index within a virtual table. */
|
||||
tree vindex;
|
||||
|
||||
/* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is
|
||||
DECL_FUNCTION_CODE. Otherwise unused.
|
||||
??? The bitfield needs to be able to hold all target function
|
||||
|
|
|
|||
|
|
@ -726,7 +726,6 @@ lto_input_ts_decl_non_common_tree_pointers (struct lto_input_block *ib,
|
|||
{
|
||||
if (TREE_CODE (expr) == TYPE_DECL)
|
||||
DECL_ORIGINAL_TYPE (expr) = stream_read_tree (ib, data_in);
|
||||
DECL_VINDEX (expr) = stream_read_tree (ib, data_in);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -773,8 +772,8 @@ static void
|
|||
lto_input_ts_function_decl_tree_pointers (struct lto_input_block *ib,
|
||||
struct data_in *data_in, tree expr)
|
||||
{
|
||||
/* DECL_STRUCT_FUNCTION is handled by lto_input_function. FIXME lto,
|
||||
maybe it should be handled here? */
|
||||
DECL_VINDEX (expr) = stream_read_tree (ib, data_in);
|
||||
/* DECL_STRUCT_FUNCTION is loaded on demand by cgraph_get_body. */
|
||||
DECL_FUNCTION_PERSONALITY (expr) = stream_read_tree (ib, data_in);
|
||||
/* DECL_FUNCTION_SPECIFIC_TARGET is regenerated from attributes. */
|
||||
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr) = stream_read_tree (ib, data_in);
|
||||
|
|
|
|||
|
|
@ -638,7 +638,6 @@ write_ts_decl_non_common_tree_pointers (struct output_block *ob, tree expr,
|
|||
{
|
||||
if (TREE_CODE (expr) == TYPE_DECL)
|
||||
stream_write_tree (ob, DECL_ORIGINAL_TYPE (expr), ref_p);
|
||||
stream_write_tree (ob, DECL_VINDEX (expr), ref_p);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -682,6 +681,7 @@ static void
|
|||
write_ts_function_decl_tree_pointers (struct output_block *ob, tree expr,
|
||||
bool ref_p)
|
||||
{
|
||||
stream_write_tree (ob, DECL_VINDEX (expr), ref_p);
|
||||
/* DECL_STRUCT_FUNCTION is handled by lto_output_function. FIXME lto,
|
||||
maybe it should be handled here? */
|
||||
stream_write_tree (ob, DECL_FUNCTION_PERSONALITY (expr), ref_p);
|
||||
|
|
|
|||
|
|
@ -5306,7 +5306,6 @@ find_decls_types_r (tree *tp, int *ws, void *data)
|
|||
else if (TREE_CODE (t) == TYPE_DECL)
|
||||
{
|
||||
fld_worklist_push (DECL_ARGUMENT_FLD (t), fld);
|
||||
fld_worklist_push (DECL_VINDEX (t), fld);
|
||||
fld_worklist_push (DECL_ORIGINAL_TYPE (t), fld);
|
||||
}
|
||||
else if (TREE_CODE (t) == FIELD_DECL)
|
||||
|
|
|
|||
|
|
@ -2470,10 +2470,9 @@ extern void decl_fini_priority_insert (tree, priority_type);
|
|||
is the FUNCTION_DECL which this FUNCTION_DECL will replace as a virtual
|
||||
function. When the class is laid out, this pointer is changed
|
||||
to an INTEGER_CST node which is suitable for use as an index
|
||||
into the virtual function table.
|
||||
C++ also uses this field in namespaces, hence the DECL_NON_COMMON_CHECK. */
|
||||
into the virtual function table. */
|
||||
#define DECL_VINDEX(NODE) \
|
||||
(DECL_NON_COMMON_CHECK (NODE)->decl_non_common.vindex)
|
||||
(FUNCTION_DECL_CHECK (NODE)->function_decl.vindex)
|
||||
|
||||
/* In FUNCTION_DECL, holds the decl for the return value. */
|
||||
#define DECL_RESULT(NODE) (FUNCTION_DECL_CHECK (NODE)->decl_non_common.result)
|
||||
|
|
@ -2485,7 +2484,7 @@ extern void decl_fini_priority_insert (tree, priority_type);
|
|||
/* In a FUNCTION_DECL, the saved representation of the body of the
|
||||
entire function. */
|
||||
#define DECL_SAVED_TREE(NODE) \
|
||||
(FUNCTION_DECL_CHECK (NODE)->decl_non_common.saved_tree)
|
||||
(FUNCTION_DECL_CHECK (NODE)->function_decl.saved_tree)
|
||||
|
||||
/* Nonzero in a FUNCTION_DECL means this function should be treated
|
||||
as if it were a malloc, meaning it returns a pointer that is
|
||||
|
|
|
|||
Loading…
Reference in New Issue