]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/binutils-tumbl.git/commitdiff
merge from gcc
authorDJ Delorie <dj@delorie.com>
Wed, 18 Jul 2012 20:08:53 +0000 (20:08 +0000)
committerDJ Delorie <dj@delorie.com>
Wed, 18 Jul 2012 20:08:53 +0000 (20:08 +0000)
libiberty/ChangeLog
libiberty/cp-demangle.c
libiberty/testsuite/demangle-expected

index 4ece5ab7474cf34c750fa7306a1daf7951b04d64..716a2ce9d235ba0c7cbfde6c1eb95a0e627f0f46 100644 (file)
@@ -1,3 +1,9 @@
+2012-07-18  Jason Merrill  <jason@redhat.com>
+
+       * cp-demangle.c (cplus_demangle_operators): Add *_cast.
+       (op_is_new_cast): New.
+       (d_expression, d_print_comp): Check it.
+
 2012-07-13  Doug Evans  <dje@google.com>
 
        * filename_cmp.c (filename_hash, filename_eq): New functions.
index 27cc323f2a24c03c584e8ec74961d9d92e5e49b0..258aaa715504a293a677cc5d087b4929855a6bdf 100644 (file)
@@ -1582,11 +1582,13 @@ const struct demangle_operator_info cplus_demangle_operators[] =
   { "an", NL ("&"),         2 },
   { "at", NL ("alignof "),   1 },
   { "az", NL ("alignof "),   1 },
+  { "cc", NL ("const_cast"), 2 },
   { "cl", NL ("()"),        2 },
   { "cm", NL (","),         2 },
   { "co", NL ("~"),         1 },
   { "dV", NL ("/="),        2 },
   { "da", NL ("delete[] "), 1 },
+  { "dc", NL ("dynamic_cast"), 2 },
   { "de", NL ("*"),         1 },
   { "dl", NL ("delete "),   1 },
   { "ds", NL (".*"),        2 },
@@ -1626,8 +1628,10 @@ const struct demangle_operator_info cplus_demangle_operators[] =
   { "qu", NL ("?"),         3 },
   { "rM", NL ("%="),        2 },
   { "rS", NL (">>="),       2 },
+  { "rc", NL ("reinterpret_cast"), 2 },
   { "rm", NL ("%"),         2 },
   { "rs", NL (">>"),        2 },
+  { "sc", NL ("static_cast"), 2 },
   { "st", NL ("sizeof "),   1 },
   { "sz", NL ("sizeof "),   1 },
   { "tr", NL ("throw"),     0 },
@@ -2809,6 +2813,18 @@ d_exprlist (struct d_info *di, char terminator)
   return list;
 }
 
+/* Returns nonzero iff OP is an operator for a C++ cast: const_cast,
+   dynamic_cast, static_cast or reinterpret_cast.  */
+
+static int
+op_is_new_cast (struct demangle_component *op)
+{
+  const char *code = op->u.s_operator.op->code;
+  return (code[1] == 'c'
+         && (code[0] == 's' || code[0] == 'd'
+             || code[0] == 'c' || code[0] == 'r'));
+}
+
 /* <expression> ::= <(unary) operator-name> <expression>
                 ::= <(binary) operator-name> <expression> <expression>
                 ::= <(trinary) operator-name> <expression> <expression> <expression>
@@ -2971,7 +2987,10 @@ d_expression (struct d_info *di)
            struct demangle_component *left;
            struct demangle_component *right;
 
-           left = d_expression (di);
+           if (op_is_new_cast (op))
+             left = cplus_demangle_type (di);
+           else
+             left = d_expression (di);
            if (!strcmp (code, "cl"))
              right = d_exprlist (di, 'E');
            else if (!strcmp (code, "dt") || !strcmp (code, "pt"))
@@ -4455,6 +4474,17 @@ d_print_comp (struct d_print_info *dpi, int options,
          return;
        }
 
+      if (op_is_new_cast (d_left (dc)))
+       {
+         d_print_expr_op (dpi, options, d_left (dc));
+         d_append_char (dpi, '<');
+         d_print_comp (dpi, options, d_left (d_right (dc)));
+         d_append_string (dpi, ">(");
+         d_print_comp (dpi, options, d_right (d_right (dc)));
+         d_append_char (dpi, ')');
+         return;
+       }
+
       /* We wrap an expression which uses the greater-than operator in
         an extra layer of parens so that it does not get confused
         with the '>' which ends the template parameters.  */
index 58c1368187754e4993d111f2e1a4a7d9ab97c105..6b55d30298e54250e9988c5ca50282283894d1a1 100644 (file)
@@ -4081,6 +4081,9 @@ decltype (new auto({parm#1})) f<int>(int)
 --format=gnu-v3
 _Z1fIiERDaRKT_S1_
 auto& f<int>(int const&, int)
+--format=gnu-v3
+_Z1gILi1EEvR1AIXT_EER1BIXscbT_EE
+void g<1>(A<1>&, B<static_cast<bool>(1)>&)
 #
 # Ada (GNAT) tests.
 #