tree.h (build_distinct_type_copy): New.

* tree.h (build_distinct_type_copy): New.
	(build_type_copy): ... here.  Rename to ...
	(build_variant_type_copy): ... here.
	* tree.c (build_qualified_type): Rename build_type_copy call.
	(build_distinct_type_copy): New, broken out of ...
	(build_type_copy): ... here.  Rename to ...
	(build_variant_type_copy): ... here.  Use
	build_distinct_type_copy.
	(build_common_tree_nodes_2): Rename build_type_copy call.
	* c-common.c (c_common_nodes_and_builtins): Rename build_type_copy
	call.
	(handle_packed_attribute, handle_unused_attribute,
	handle_transparanet_union_attribute, handle_aligned_attribute,
	handle_deprecated_attribute): Likewise.
	* c-decl.c (clone_underlying_type, store_parm_decls_oldstyle):
	Likewise.
	* config/arm/arm.c (arm_handle_isr_attribyte): Likewise.
	* config/rs6000/rs6000.c (rs6000_init_builtins): Use
	build_distinct_type_copy.

	* cp/name-lookup.c (pushdecl): Rename build_type_copy call.
	* cp/tree.c (cp_build_qualified_type_real,
	build_exception_variant, handle_java_interface_attribute): Likewise.

From-SVN: r86421
This commit is contained in:
Nathan Sidwell 2004-08-23 08:41:57 +00:00 committed by Nathan Sidwell
parent e8bf0f3bac
commit 8dd16ecc7d
10 changed files with 74 additions and 32 deletions

View File

@ -1,3 +1,25 @@
2004-08-23 Nathan Sidwell <nathan@codesourcery.com>
* tree.h (build_distinct_type_copy): New.
(build_type_copy): ... here. Rename to ...
(build_variant_type_copy): ... here.
* tree.c (build_qualified_type): Rename build_type_copy call.
(build_distinct_type_copy): New, broken out of ...
(build_type_copy): ... here. Rename to ...
(build_variant_type_copy): ... here. Use
build_distinct_type_copy.
(build_common_tree_nodes_2): Rename build_type_copy call.
* c-common.c (c_common_nodes_and_builtins): Rename build_type_copy
call.
(handle_packed_attribute, handle_unused_attribute,
handle_transparanet_union_attribute, handle_aligned_attribute,
handle_deprecated_attribute): Likewise.
* c-decl.c (clone_underlying_type, store_parm_decls_oldstyle):
Likewise.
* config/arm/arm.c (arm_handle_isr_attribyte): Likewise.
* config/rs6000/rs6000.c (rs6000_init_builtins): Use
build_distinct_type_copy.
2004-08-23 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips.md (mfhilo_[sd]i): Redefine using :GPR. Add mode

View File

@ -2997,7 +2997,7 @@ c_common_nodes_and_builtins (void)
if (c_dialect_cxx ())
/* For C++, make fileptr_type_node a distinct void * type until
FILE type is defined. */
fileptr_type_node = build_type_copy (ptr_type_node);
fileptr_type_node = build_variant_type_copy (ptr_type_node);
record_builtin_type (RID_VOID, NULL, void_type_node);
@ -3925,7 +3925,7 @@ handle_packed_attribute (tree *node, tree name, tree ARG_UNUSED (args),
if (TYPE_P (*node))
{
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
*node = build_type_copy (*node);
*node = build_variant_type_copy (*node);
TYPE_PACKED (*node) = 1;
if (TYPE_MAIN_VARIANT (*node) == *node)
{
@ -4114,7 +4114,7 @@ handle_unused_attribute (tree *node, tree name, tree ARG_UNUSED (args),
else
{
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
*node = build_type_copy (*node);
*node = build_variant_type_copy (*node);
TREE_USED (*node) = 1;
}
@ -4176,7 +4176,7 @@ handle_transparent_union_attribute (tree *node, tree name,
&& TYPE_MODE (*type) == DECL_MODE (TYPE_FIELDS (*type)))))
{
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
*type = build_type_copy (*type);
*type = build_variant_type_copy (*type);
TYPE_TRANSPARENT_UNION (*type) = 1;
}
else if (decl != 0 && TREE_CODE (decl) == PARM_DECL
@ -4451,14 +4451,14 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
&& DECL_ORIGINAL_TYPE (decl) == NULL_TREE)
{
tree tt = TREE_TYPE (decl);
*type = build_type_copy (*type);
*type = build_variant_type_copy (*type);
DECL_ORIGINAL_TYPE (decl) = tt;
TYPE_NAME (*type) = decl;
TREE_USED (*type) = TREE_USED (decl);
TREE_TYPE (decl) = *type;
}
else if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
*type = build_type_copy (*type);
*type = build_variant_type_copy (*type);
TYPE_ALIGN (*type) = (1 << i) * BITS_PER_UNIT;
TYPE_USER_ALIGN (*type) = 1;
@ -4805,7 +4805,7 @@ handle_deprecated_attribute (tree *node, tree name,
else if (TYPE_P (*node))
{
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
*node = build_type_copy (*node);
*node = build_variant_type_copy (*node);
TREE_DEPRECATED (*node) = 1;
type = *node;
}

View File

@ -1843,7 +1843,7 @@ clone_underlying_type (tree x)
{
tree tt = TREE_TYPE (x);
DECL_ORIGINAL_TYPE (x) = tt;
tt = build_type_copy (tt);
tt = build_variant_type_copy (tt);
TYPE_NAME (tt) = x;
TREE_USED (tt) = TREE_USED (x);
TREE_TYPE (x) = tt;
@ -6198,7 +6198,7 @@ store_parm_decls_oldstyle (tree fndecl, tree arg_info)
will be a variant of the main variant of the original function
type. */
TREE_TYPE (fndecl) = build_type_copy (TREE_TYPE (fndecl));
TREE_TYPE (fndecl) = build_variant_type_copy (TREE_TYPE (fndecl));
TYPE_ACTUAL_ARG_TYPES (TREE_TYPE (fndecl)) = actual;
}

View File

@ -2625,7 +2625,7 @@ arm_handle_isr_attribute (tree *node, tree name, tree args, int flags,
|| TREE_CODE (TREE_TYPE (*node)) == METHOD_TYPE)
&& arm_isr_value (args) != ARM_FT_UNKNOWN)
{
*node = build_type_copy (*node);
*node = build_variant_type_copy (*node);
TREE_TYPE (*node) = build_type_attribute_variant
(TREE_TYPE (*node),
tree_cons (name, args, TYPE_ATTRIBUTES (TREE_TYPE (*node))));

View File

@ -7249,14 +7249,10 @@ rs6000_init_builtins (void)
types, especially in C++ land. Similarly, 'vector pixel' is distinct from
'vector unsigned short'. */
bool_char_type_node = copy_node (unsigned_intQI_type_node);
TYPE_MAIN_VARIANT (bool_char_type_node) = bool_char_type_node;
bool_short_type_node = copy_node (unsigned_intHI_type_node);
TYPE_MAIN_VARIANT (bool_short_type_node) = bool_short_type_node;
bool_int_type_node = copy_node (unsigned_intSI_type_node);
TYPE_MAIN_VARIANT (bool_int_type_node) = bool_int_type_node;
pixel_type_node = copy_node (unsigned_intHI_type_node);
TYPE_MAIN_VARIANT (pixel_type_node) = pixel_type_node;
bool_char_type_node = build_distinct_type_copy (unsigned_intQI_type_node);
bool_short_type_node = build_distinct_type_copy (unsigned_intHI_type_node);
bool_int_type_node = build_distinct_type_copy (unsigned_intSI_type_node);
pixel_type_node = build_distinct_type_copy (unsigned_intHI_type_node);
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
get_identifier ("__bool char"),

View File

@ -1,3 +1,9 @@
2004-08-23 Nathan Sidwell <nathan@codesourcery.com>
* name-lookup.c (pushdecl): Rename build_type_copy call.
* tree.c (cp_build_qualified_type_real,
build_exception_variant, handle_java_interface_attribute): Likewise.
2004-08-22 Andrew Pinski <apinski@apple.com>
PR c++/14029

View File

@ -850,7 +850,7 @@ pushdecl (tree x)
|| TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x)))
{
DECL_ORIGINAL_TYPE (x) = type;
type = build_type_copy (type);
type = build_variant_type_copy (type);
TYPE_STUB_DECL (type) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE (x));
TYPE_NAME (type) = x;
TREE_TYPE (x) = type;

View File

@ -465,7 +465,7 @@ cp_build_qualified_type_real (tree type,
{
/* Make a new array type, just like the old one, but with the
appropriately qualified element type. */
t = build_type_copy (type);
t = build_variant_type_copy (type);
TREE_TYPE (t) = element_type;
}
@ -942,7 +942,7 @@ build_exception_variant (tree type, tree raises)
return v;
/* Need to build a new variant. */
v = build_type_copy (type);
v = build_variant_type_copy (type);
TYPE_RAISES_EXCEPTIONS (v) = raises;
return v;
}
@ -1776,7 +1776,7 @@ handle_java_interface_attribute (tree* node,
return NULL_TREE;
}
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
*node = build_type_copy (*node);
*node = build_variant_type_copy (*node);
TYPE_JAVA_INTERFACE (*node) = 1;
return NULL_TREE;

View File

@ -3126,22 +3126,21 @@ build_qualified_type (tree type, int type_quals)
/* If not, build it. */
if (!t)
{
t = build_type_copy (type);
t = build_variant_type_copy (type);
set_type_quals (t, type_quals);
}
return t;
}
/* Create a new variant of TYPE, equivalent but distinct.
This is so the caller can modify it. */
/* Create a new distinct copy of TYPE. The new type is made its own
MAIN_VARIANT. */
tree
build_type_copy (tree type)
build_distinct_type_copy (tree type)
{
tree t, m = TYPE_MAIN_VARIANT (type);
t = copy_node (type);
tree t = copy_node (type);
if (TYPE_CACHED_VALUES_P(t))
{
/* Do not copy the values cache. */
@ -3154,9 +3153,27 @@ build_type_copy (tree type)
TYPE_POINTER_TO (t) = 0;
TYPE_REFERENCE_TO (t) = 0;
/* Add this type to the chain of variants of TYPE. */
/* Make it its own variant. */
TYPE_MAIN_VARIANT (t) = t;
TYPE_NEXT_VARIANT (t) = 0;
return t;
}
/* Create a new variant of TYPE, equivalent but distinct.
This is so the caller can modify it. */
tree
build_variant_type_copy (tree type)
{
tree t, m = TYPE_MAIN_VARIANT (type);
t = build_distinct_type_copy (type);
/* Add the new type to the chain of variants of TYPE. */
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
TYPE_NEXT_VARIANT (m) = t;
TYPE_MAIN_VARIANT (t) = m;
return t;
}
@ -5494,7 +5511,7 @@ build_common_tree_nodes_2 (int short_double)
don't copy record types and let c_common_nodes_and_builtins()
declare the type to be __builtin_va_list. */
if (TREE_CODE (t) != RECORD_TYPE)
t = build_type_copy (t);
t = build_variant_type_copy (t);
va_list_type_node = t;
}

View File

@ -2961,7 +2961,8 @@ extern tree build_qualified_type (tree, int);
/* Make a copy of a type node. */
extern tree build_type_copy (tree);
extern tree build_distinct_type_copy (tree);
extern tree build_variant_type_copy (tree);
/* Finish up a builtin RECORD_TYPE. Give it a name and provide its
fields. Optionally specify an alignment, and then lay it out. */