diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-23 08:41:57 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-23 08:41:57 +0000 |
commit | e086912ef49705e0884bb4d8db71a444bedaa4fd (patch) | |
tree | 21e04c3973bfdab79a845ae2282b15da19d7926c /gcc/tree.c | |
parent | e45cb88635ea4636ac79facaa1fb064e084d9996 (diff) | |
download | ppe42-gcc-e086912ef49705e0884bb4d8db71a444bedaa4fd.tar.gz ppe42-gcc-e086912ef49705e0884bb4d8db71a444bedaa4fd.zip |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86421 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index cd298e86013..e2cf0c0ad88 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -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; } |