aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2002-04-25 01:05:25 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2002-04-25 01:05:25 +0000
commitb970a21d1d35e0be3f32b967f56b6219f42aeb61 (patch)
tree8c3b7ca21c4b39b3beb16b79e48cc412d56b4838 /gcc/cp
parenta49cfba81bf9021a62ca111e7f7baea84213a19a (diff)
downloadgcc-b970a21d1d35e0be3f32b967f56b6219f42aeb61.zip
gcc-b970a21d1d35e0be3f32b967f56b6219f42aeb61.tar.gz
gcc-b970a21d1d35e0be3f32b967f56b6219f42aeb61.tar.bz2
mangle.c (write_type): Don't use TYPE_MAIN_VARIANT when writing out an array type.
* mangle.c (write_type): Don't use TYPE_MAIN_VARIANT when writing out an array type. (write_CV_qualifiers_for_type): Use TYPE_QUALS, not cp_type_quals, to determine qualifiers. From-SVN: r52749
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/mangle.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 88461e2..322769c 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1358,6 +1358,11 @@ write_type (type)
since both the qualified and uqualified types are substitution
candidates. */
write_type (TYPE_MAIN_VARIANT (type));
+ else if (TREE_CODE (type) == ARRAY_TYPE)
+ /* It is important not to use the TYPE_MAIN_VARIANT of TYPE here
+ so that the cv-qualification of the element type is available
+ in write_array_type. */
+ write_array_type (type);
else
{
/* See through any typedefs. */
@@ -1404,10 +1409,6 @@ write_type (type)
write_nested_name (TYPE_STUB_DECL (type));
break;
- case ARRAY_TYPE:
- write_array_type (type);
- break;
-
case POINTER_TYPE:
/* A pointer-to-member variable is represented by a POINTER_TYPE
to an OFFSET_TYPE, so check for this first. */
@@ -1474,19 +1475,23 @@ write_CV_qualifiers_for_type (type)
"In cases where multiple order-insensitive qualifiers are
present, they should be ordered 'K' (closest to the base type),
- 'V', 'r', and 'U' (farthest from the base type) ..." */
+ 'V', 'r', and 'U' (farthest from the base type) ..."
+
+ Note that we do not use cp_type_quals below; given "const
+ int[3]", the "const" is emitted with the "int", not with the
+ array. */
- if (CP_TYPE_RESTRICT_P (type))
+ if (TYPE_QUALS (type) & TYPE_QUAL_RESTRICT)
{
write_char ('r');
++num_qualifiers;
}
- if (CP_TYPE_VOLATILE_P (type))
+ if (TYPE_QUALS (type) & TYPE_QUAL_VOLATILE)
{
write_char ('V');
++num_qualifiers;
}
- if (CP_TYPE_CONST_P (type))
+ if (TYPE_QUALS (type) & TYPE_QUAL_CONST)
{
write_char ('K');
++num_qualifiers;