summaryrefslogtreecommitdiff
path: root/gcc/cp/mangle.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-21 07:20:48 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-21 07:20:48 +0000
commit1869ca576befbe5457337f88ec2e183aa66eb96f (patch)
tree5a7be8ba6dc1abd3f95a537fbc5e0ad6a7afb4ef /gcc/cp/mangle.c
parent63b82f0a74f7ec778b00401a1a273c9df747b758 (diff)
downloadgcc-1869ca576befbe5457337f88ec2e183aa66eb96f.tar.gz
2010-01-21 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 156107 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@156108 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/mangle.c')
-rw-r--r--gcc/cp/mangle.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 13b0ed47af3..c14f5b7d844 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1732,6 +1732,12 @@ write_type (tree type)
if (find_substitution (type))
return;
+ /* According to the C++ ABI, some library classes are passed the
+ same as the scalar type of their single member and use the same
+ mangling. */
+ if (TREE_CODE (type) == RECORD_TYPE && TYPE_TRANSPARENT_AGGR (type))
+ type = TREE_TYPE (first_field (type));
+
if (write_CV_qualifiers_for_type (type) > 0)
/* If TYPE was CV-qualified, we just wrote the qualifiers; now
mangle the unqualified type. The recursive call is needed here
@@ -2481,7 +2487,7 @@ write_expression (tree expr)
}
else
{
- int i;
+ int i, len;
const char *name;
/* When we bind a variable or function to a non-type template
@@ -2582,7 +2588,27 @@ write_expression (tree expr)
break;
default:
- for (i = 0; i < TREE_OPERAND_LENGTH (expr); ++i)
+ /* In the middle-end, some expressions have more operands than
+ they do in templates (and mangling). */
+ switch (code)
+ {
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
+ len = 1;
+ break;
+
+ case ARRAY_REF:
+ len = 2;
+ break;
+
+ default:
+ len = TREE_OPERAND_LENGTH (expr);
+ break;
+ }
+
+ for (i = 0; i < len; ++i)
{
tree operand = TREE_OPERAND (expr, i);
/* As a GNU extension, the middle operand of a