aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-05-12 00:24:33 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2015-05-11 22:24:33 +0000
commit5ce039dfe917d694bef1ecb16844f3b1bcb7ed09 (patch)
treeb27aa77b5c6f68e088a61128b1c06c597c6b36f9 /gcc/tree.c
parent20d4397af8a085a17925d3a3a3545748d5ab7fc6 (diff)
downloadgcc-5ce039dfe917d694bef1ecb16844f3b1bcb7ed09.zip
gcc-5ce039dfe917d694bef1ecb16844f3b1bcb7ed09.tar.gz
gcc-5ce039dfe917d694bef1ecb16844f3b1bcb7ed09.tar.bz2
class.c (fixup_type_variants): Do not copy TYPE_METHODS
* class.c (fixup_type_variants): Do not copy TYPE_METHODS (one_inheriting_sig): Assert tat we always set TYPE_METHODS of main variant. * semantics.c (finish_member_declaration): Likewise. * method.c (lazily_declare_fn): Allways add method to main variant list. * dwarf2out.c (gen_member_die): Sanity check that we access TYPE_MAIN_VARIANT for TYPE_METHODS. * function.c (use_register_for_decl): Look for TYPE_MAIN_VARIANT when checking TYPE_METHODS. * tree.c (free_lang_data_in_type): See TYPE_METHODS to error_mark_node if non-null. (build_distinct_type_copy): Clear TYPE_METHODS. (verify_type_variant): Verify that TYPE_METHODS is NULL for variants. (verify_type): Allow TYPE_METHODS to be error_mark_node. * tree.def: Update docs of YTPE_STUB_DECL and TYPE_METHODS. From-SVN: r223021
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 0c97667..97e84eb 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5100,7 +5100,13 @@ free_lang_data_in_type (tree type)
if (TYPE_VFIELD (type) && TREE_CODE (TYPE_VFIELD (type)) != FIELD_DECL)
TYPE_VFIELD (type) = NULL_TREE;
- TYPE_METHODS (type) = NULL_TREE;
+ /* Remove TYPE_METHODS list. While it would be nice to keep it
+ to enable ODR warnings about different method lists, doing so
+ seems to impractically increase size of LTO data streamed.
+ Keep the infrmation if TYPE_METHODS was non-NULL. This is used
+ by function.c and pretty printers. */
+ if (TYPE_METHODS (type))
+ TYPE_METHODS (type) = error_mark_node;
if (TYPE_BINFO (type))
{
free_lang_data_in_binfo (TYPE_BINFO (type));
@@ -6574,6 +6580,12 @@ build_distinct_type_copy (tree type)
TYPE_MAIN_VARIANT (t) = t;
TYPE_NEXT_VARIANT (t) = 0;
+ /* We do not record methods in type copies nor variants
+ so we do not need to keep them up to date when new method
+ is inserted. */
+ if (RECORD_OR_UNION_TYPE_P (t))
+ TYPE_METHODS (t) = NULL_TREE;
+
/* Note that it is now possible for TYPE_MIN_VALUE to be a value
whose TREE_TYPE is not t. This can also happen in the Ada
frontend when using subtypes. */
@@ -12528,13 +12540,9 @@ verify_type_variant (const_tree t, tree tv)
debug_tree (tv);
return false;
}
- /* FIXME: this check triggers during libstdc++ build that is a bug.
- It affects non-LTO debug output only, because free_lang_data clears
- this anyway. */
- if (RECORD_OR_UNION_TYPE_P (t) && COMPLETE_TYPE_P (t) && 0
- && TYPE_METHODS (t) != TYPE_METHODS (tv))
+ if (RECORD_OR_UNION_TYPE_P (t) && TYPE_METHODS (t))
{
- error ("type variant has different TYPE_METHODS");
+ error ("type variant has TYPE_METHODS");
debug_tree (tv);
return false;
}
@@ -12749,9 +12757,10 @@ verify_type (const_tree t)
if (RECORD_OR_UNION_TYPE_P (t))
{
if (TYPE_METHODS (t) && TREE_CODE (TYPE_METHODS (t)) != FUNCTION_DECL
- && TREE_CODE (TYPE_METHODS (t)) != TEMPLATE_DECL)
+ && TREE_CODE (TYPE_METHODS (t)) != TEMPLATE_DECL
+ && TYPE_METHODS (t) != error_mark_node)
{
- error ("TYPE_METHODS is not FUNCTION_DECL nor TEMPLATE_DECL");
+ error ("TYPE_METHODS is not FUNCTION_DECL, TEMPLATE_DECL nor error_mark_node");
debug_tree (TYPE_METHODS (t));
error_found = true;
}