Commit 36b56cd3 by Jan Hubicka Committed by Jan Hubicka

tree.c (free_lang_data_in_type): Add fld parameter; simplify return and…

tree.c (free_lang_data_in_type): Add fld parameter; simplify return and parameter types of function and method types.


	* tree.c (free_lang_data_in_type): Add fld parameter; simplify
	return and parameter types of function and method types.
	(free_lang_data_in_cgraph): Update.

From-SVN: r265870
parent 907050e3
2018-11-07 Jan Hubicka <jh@suse.cz>
* tree.c (free_lang_data_in_type): Add fld parameter; simplify
return and parameter types of function and method types.
(free_lang_data_in_cgraph): Update.
2018-11-07 Martin Liska <mliska@suse.cz> 2018-11-07 Martin Liska <mliska@suse.cz>
PR rtl-optimization/87868 PR rtl-optimization/87868
2018-11-07 Jan Hubicka <jh@suse.cz>
* g++.dg/lto/odr-1_1.C: Fix template.
2018-11-07 Chenghua Xu <paul.hua.gm@gmail.com> 2018-11-07 Chenghua Xu <paul.hua.gm@gmail.com>
* gcc.target/mips/loongson-ctz.c: New test. * gcc.target/mips/loongson-ctz.c: New test.
......
...@@ -4,7 +4,7 @@ namespace { ...@@ -4,7 +4,7 @@ namespace {
struct a { struct a {
struct b *ptr; struct b *ptr;
}; };
void test(struct a *); // { dg-lto-warning "6: 'test' violates the C\\+\\+ One Definition Rule" } void test(struct a *);
int int
main(void) main(void)
{ {
......
...@@ -5261,7 +5261,7 @@ free_lang_data_in_binfo (tree binfo) ...@@ -5261,7 +5261,7 @@ free_lang_data_in_binfo (tree binfo)
/* Reset all language specific information still present in TYPE. */ /* Reset all language specific information still present in TYPE. */
static void static void
free_lang_data_in_type (tree type) free_lang_data_in_type (tree type, struct free_lang_data_d *fld)
{ {
gcc_assert (TYPE_P (type)); gcc_assert (TYPE_P (type));
...@@ -5280,6 +5280,7 @@ free_lang_data_in_type (tree type) ...@@ -5280,6 +5280,7 @@ free_lang_data_in_type (tree type)
if (TREE_CODE (type) == FUNCTION_TYPE) if (TREE_CODE (type) == FUNCTION_TYPE)
{ {
TREE_TYPE (type) = fld_simplified_type (TREE_TYPE (type), fld);
/* Remove the const and volatile qualifiers from arguments. The /* Remove the const and volatile qualifiers from arguments. The
C++ front end removes them, but the C front end does not, C++ front end removes them, but the C front end does not,
leading to false ODR violation errors when merging two leading to false ODR violation errors when merging two
...@@ -5287,6 +5288,7 @@ free_lang_data_in_type (tree type) ...@@ -5287,6 +5288,7 @@ free_lang_data_in_type (tree type)
different front ends. */ different front ends. */
for (tree p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p)) for (tree p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p))
{ {
TREE_VALUE (p) = fld_simplified_type (TREE_VALUE (p), fld);
tree arg_type = TREE_VALUE (p); tree arg_type = TREE_VALUE (p);
if (TYPE_READONLY (arg_type) || TYPE_VOLATILE (arg_type)) if (TYPE_READONLY (arg_type) || TYPE_VOLATILE (arg_type))
...@@ -5295,16 +5297,22 @@ free_lang_data_in_type (tree type) ...@@ -5295,16 +5297,22 @@ free_lang_data_in_type (tree type)
& ~TYPE_QUAL_CONST & ~TYPE_QUAL_CONST
& ~TYPE_QUAL_VOLATILE; & ~TYPE_QUAL_VOLATILE;
TREE_VALUE (p) = build_qualified_type (arg_type, quals); TREE_VALUE (p) = build_qualified_type (arg_type, quals);
free_lang_data_in_type (TREE_VALUE (p)); free_lang_data_in_type (TREE_VALUE (p), fld);
} }
/* C++ FE uses TREE_PURPOSE to store initial values. */ /* C++ FE uses TREE_PURPOSE to store initial values. */
TREE_PURPOSE (p) = NULL; TREE_PURPOSE (p) = NULL;
} }
} }
else if (TREE_CODE (type) == METHOD_TYPE) else if (TREE_CODE (type) == METHOD_TYPE)
for (tree p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p)) {
/* C++ FE uses TREE_PURPOSE to store initial values. */ TREE_TYPE (type) = fld_simplified_type (TREE_TYPE (type), fld);
TREE_PURPOSE (p) = NULL; for (tree p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p))
{
/* C++ FE uses TREE_PURPOSE to store initial values. */
TREE_VALUE (p) = fld_simplified_type (TREE_VALUE (p), fld);
TREE_PURPOSE (p) = NULL;
}
}
else if (RECORD_OR_UNION_TYPE_P (type)) else if (RECORD_OR_UNION_TYPE_P (type))
{ {
/* Remove members that are not FIELD_DECLs from the field list /* Remove members that are not FIELD_DECLs from the field list
...@@ -5468,6 +5476,7 @@ free_lang_data_in_decl (tree decl, struct free_lang_data_d *fld) ...@@ -5468,6 +5476,7 @@ free_lang_data_in_decl (tree decl, struct free_lang_data_d *fld)
if (TREE_CODE (decl) == FUNCTION_DECL) if (TREE_CODE (decl) == FUNCTION_DECL)
{ {
struct cgraph_node *node; struct cgraph_node *node;
TREE_TYPE (decl) = fld_simplified_type (TREE_TYPE (decl), fld);
if (!(node = cgraph_node::get (decl)) if (!(node = cgraph_node::get (decl))
|| (!node->definition && !node->clones)) || (!node->definition && !node->clones))
{ {
...@@ -5985,7 +5994,7 @@ free_lang_data_in_cgraph (void) ...@@ -5985,7 +5994,7 @@ free_lang_data_in_cgraph (void)
/* Traverse every type found freeing its language data. */ /* Traverse every type found freeing its language data. */
FOR_EACH_VEC_ELT (fld.types, i, t) FOR_EACH_VEC_ELT (fld.types, i, t)
free_lang_data_in_type (t); free_lang_data_in_type (t, &fld);
if (flag_checking) if (flag_checking)
{ {
FOR_EACH_VEC_ELT (fld.types, i, t) FOR_EACH_VEC_ELT (fld.types, i, t)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment