aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-11-20 07:15:03 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2014-11-20 06:15:03 +0000
commit1be0e58d3003aa8a780d229bf38b0e4a61928b9e (patch)
treeb027bc052b062a295ed4e82de7214afde37561ce /gcc/tree.c
parent1b5695e6100dec3f7c1e86ba5594471987cda466 (diff)
downloadgcc-1be0e58d3003aa8a780d229bf38b0e4a61928b9e.zip
gcc-1be0e58d3003aa8a780d229bf38b0e4a61928b9e.tar.gz
gcc-1be0e58d3003aa8a780d229bf38b0e4a61928b9e.tar.bz2
tree.c (free_lang_data_in_type): If BINFO has no important information in it, set it to NULL.
* tree.c (free_lang_data_in_type): If BINFO has no important information in it, set it to NULL. (get_binfo_at_offset): Do not walk fields, only bases. * ipa-utils.h (polymorphic_type_binfo_p): Be ready for BINFO_TYPE to be NULL. * ipa-polymorphic-call.c (record_known_type): Likewise. From-SVN: r217824
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 272b2a3..6abe4c3 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4976,7 +4976,14 @@ free_lang_data_in_type (tree type)
TYPE_METHODS (type) = NULL_TREE;
if (TYPE_BINFO (type))
- free_lang_data_in_binfo (TYPE_BINFO (type));
+ {
+ free_lang_data_in_binfo (TYPE_BINFO (type));
+ if ((!BINFO_VTABLE (TYPE_BINFO (type))
+ || !flag_devirtualize)
+ && (!BINFO_N_BASE_BINFOS (TYPE_BINFO (type))
+ || debug_info_level != DINFO_LEVEL_NONE))
+ TYPE_BINFO (type) = NULL;
+ }
}
else
{
@@ -11926,7 +11933,7 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
for (fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld))
{
- if (TREE_CODE (fld) != FIELD_DECL)
+ if (TREE_CODE (fld) != FIELD_DECL || !DECL_ARTIFICIAL (fld))
continue;
pos = int_bit_position (fld);
@@ -11937,12 +11944,6 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
if (!fld || TREE_CODE (TREE_TYPE (fld)) != RECORD_TYPE)
return NULL_TREE;
- if (!DECL_ARTIFICIAL (fld))
- {
- binfo = TYPE_BINFO (TREE_TYPE (fld));
- if (!binfo)
- return NULL_TREE;
- }
/* Offset 0 indicates the primary base, whose vtable contents are
represented in the binfo for the derived class. */
else if (offset != 0)
@@ -11967,6 +11968,7 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
* BITS_PER_UNIT < pos
/* Rule out types with no virtual methods or we can get confused
here by zero sized bases. */
+ && TYPE_BINFO (BINFO_TYPE (base_binfo))
&& BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (base_binfo)))
&& (!containing_binfo
|| (tree_to_shwi (BINFO_OFFSET (containing_binfo))