aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-03-14 05:17:01 +0000
committerRichard Stallman <rms@gnu.org>1992-03-14 05:17:01 +0000
commitb4ac57ab2925e9ccedcc0ea72cd7ce55bbcd6def (patch)
tree7becaa9e8ecc06df6386da81506f366d60982698 /gcc/tree.c
parent5e3b99538d552be301a13a7fd552163d9e7dd5ae (diff)
downloadgcc-b4ac57ab2925e9ccedcc0ea72cd7ce55bbcd6def.zip
gcc-b4ac57ab2925e9ccedcc0ea72cd7ce55bbcd6def.tar.gz
gcc-b4ac57ab2925e9ccedcc0ea72cd7ce55bbcd6def.tar.bz2
*** empty log message ***
From-SVN: r478
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 710f37b..9485332 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2168,7 +2168,7 @@ build_type_variant (type, constp, volatilep)
constp = !!constp;
volatilep = !!volatilep;
- /* If not generating auxilliary info, search the chain of variants to see
+ /* If not generating auxiliary info, search the chain of variants to see
if there is already one there just like the one we need to have. If so,
use that existing one.
@@ -2199,6 +2199,31 @@ build_type_variant (type, constp, volatilep)
current_obstack = ambient_obstack;
return t;
}
+
+/* Create a new variant of TYPE, equivalent but distinct.
+ This is so the caller can modify it. */
+
+tree
+build_type_copy (type)
+ tree type;
+{
+ register tree t, m = TYPE_MAIN_VARIANT (type);
+ register struct obstack *ambient_obstack = current_obstack;
+
+ current_obstack
+ = TREE_PERMANENT (type) ? &permanent_obstack : saveable_obstack;
+
+ t = copy_node (type);
+ TYPE_POINTER_TO (t) = 0;
+ TYPE_REFERENCE_TO (t) = 0;
+
+ /* Add this type to the chain of variants of TYPE. */
+ TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
+ TYPE_NEXT_VARIANT (m) = t;
+
+ current_obstack = ambient_obstack;
+ return t;
+}
/* Hashing of types so that we don't make duplicates.
The entry point is `type_hash_canon'. */