aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-08-17 11:03:59 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-08-17 11:03:59 +0000
commit22521c89b686b99b89ba296a8f3b9bae11f0f55a (patch)
tree1c50be19ea0eb90d701daa570a3b5e5c3aafac93
parent241bea26410d0aec26d5f98d032061d9fa455a74 (diff)
downloadgcc-22521c89b686b99b89ba296a8f3b9bae11f0f55a.zip
gcc-22521c89b686b99b89ba296a8f3b9bae11f0f55a.tar.gz
gcc-22521c89b686b99b89ba296a8f3b9bae11f0f55a.tar.bz2
decl.c (build_ptrmemfunc_type): Keep variant chain intact.
2009-08-16 Richard Guenther <rguenther@suse.de> * decl.c (build_ptrmemfunc_type): Keep variant chain intact. Avoid useless copy. (finish_enum): Keep variant chain intact. * tree.c (cp_build_reference_type): Likewise. From-SVN: r150839
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c11
-rw-r--r--gcc/cp/tree.c3
3 files changed, 16 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b98842e..52625db 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-17 Richard Guenther <rguenther@suse.de>
+
+ * decl.c (build_ptrmemfunc_type): Keep variant chain intact.
+ Avoid useless copy.
+ (finish_enum): Keep variant chain intact.
+ * tree.c (cp_build_reference_type): Likewise.
+
2009-08-16 Jason Merrill <jason@redhat.com>
Make TREE_USED match the [basic.def.odr] concept for FUNCTION_DECL
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 898542f..0746b82 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7056,10 +7056,14 @@ build_ptrmemfunc_type (tree type)
/* If this is not the unqualified form of this pointer-to-member
type, set the TYPE_MAIN_VARIANT for this type to be the
unqualified type. Since they are actually RECORD_TYPEs that are
- not variants of each other, we must do this manually. */
+ not variants of each other, we must do this manually.
+ As we just built a new type there is no need to do yet another copy. */
if (cp_type_quals (type) != TYPE_UNQUALIFIED)
{
- t = build_qualified_type (t, cp_type_quals (type));
+ int type_quals = cp_type_quals (type);
+ TYPE_READONLY (t) = (type_quals & TYPE_QUAL_CONST) != 0;
+ TYPE_VOLATILE (t) = (type_quals & TYPE_QUAL_VOLATILE) != 0;
+ TYPE_RESTRICT (t) = (type_quals & TYPE_QUAL_RESTRICT) != 0;
TYPE_MAIN_VARIANT (t) = unqualified_variant;
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant);
TYPE_NEXT_VARIANT (unqualified_variant) = t;
@@ -11164,7 +11168,8 @@ finish_enum (tree enumtype)
/* Set the underlying type of the enumeration type to the
computed enumeration type, restricted to the enumerator
values. */
- ENUM_UNDERLYING_TYPE (enumtype) = copy_node (underlying_type);
+ ENUM_UNDERLYING_TYPE (enumtype)
+ = build_distinct_type_copy (underlying_type);
set_min_and_max_values_for_integral_type
(ENUM_UNDERLYING_TYPE (enumtype), precision, unsignedp);
}
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 9e194fc..1a406a3 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -700,12 +700,11 @@ cp_build_reference_type (tree to_type, bool rval)
if (TYPE_REF_IS_RVALUE (t))
return t;
- t = copy_node (lvalue_ref);
+ t = build_distinct_type_copy (lvalue_ref);
TYPE_REF_IS_RVALUE (t) = true;
TYPE_NEXT_REF_TO (t) = TYPE_NEXT_REF_TO (lvalue_ref);
TYPE_NEXT_REF_TO (lvalue_ref) = t;
- TYPE_MAIN_VARIANT (t) = t;
if (TYPE_STRUCTURAL_EQUALITY_P (to_type))
SET_TYPE_STRUCTURAL_EQUALITY (t);