* 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
+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
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);
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)
{
else
{
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
- *node = build_type_copy (*node);
+ *node = build_variant_type_copy (*node);
TREE_USED (*node) = 1;
}
&& 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
&& 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;
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;
}
{
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;
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;
}
|| 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))));
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"),
+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
|| 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;
{
/* 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;
}
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;
}
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;
/* 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. */
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;
}
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;
}
/* 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. */