diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2004-08-23 08:41:57 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2004-08-23 08:41:57 +0000 |
commit | 8dd16ecc7d71b9f1e1bdc4d870cf2436db9594a9 (patch) | |
tree | 21e04c3973bfdab79a845ae2282b15da19d7926c /gcc/tree.c | |
parent | e8bf0f3bacc5f3f4ae892f4df794cc23e41519b9 (diff) | |
download | gcc-8dd16ecc7d71b9f1e1bdc4d870cf2436db9594a9.zip gcc-8dd16ecc7d71b9f1e1bdc4d870cf2436db9594a9.tar.gz gcc-8dd16ecc7d71b9f1e1bdc4d870cf2436db9594a9.tar.bz2 |
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
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 35 |
1 files changed, 26 insertions, 9 deletions
@@ -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; } |