OSDN Git Service

2010-05-08 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / libiberty / cp-demangle.c
index 75706b3..6db1f78 100644 (file)
@@ -1987,6 +1987,8 @@ cplus_demangle_builtin_types[D_BUILTIN_TYPE_COUNT] =
   /* 29 */ { NL ("half"),      NL ("half"),            D_PRINT_FLOAT },
   /* 30 */ { NL ("char16_t"),  NL ("char16_t"),        D_PRINT_DEFAULT },
   /* 31 */ { NL ("char32_t"),  NL ("char32_t"),        D_PRINT_DEFAULT },
+  /* 32 */ { NL ("decltype(nullptr)"), NL ("decltype(nullptr)"),
+            D_PRINT_DEFAULT },
 };
 
 CP_STATIC_IF_GLIBCPP_V3
@@ -2221,6 +2223,12 @@ cplus_demangle_type (struct d_info *di)
          ret = d_vector_type (di);
          break;
 
+        case 'n':
+          /* decltype(nullptr) */
+         ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[32]);
+         di->expansion += ret->u.s_builtin.type->len;
+         break;
+
        default:
          return NULL;
        }
@@ -2722,11 +2730,18 @@ d_expression (struct d_info *di)
 
       return d_make_function_param (di, index);
     }
-  else if (IS_DIGIT (peek))
+  else if (IS_DIGIT (peek)
+          || (peek == 'o' && d_peek_next_char (di) == 'n'))
     {
       /* We can get an unqualified name as an expression in the case of
-         a dependent member access, i.e. decltype(T().i).  */
-      struct demangle_component *name = d_unqualified_name (di);
+         a dependent function call, i.e. decltype(f(t)).  */
+      struct demangle_component *name;
+
+      if (peek == 'o')
+       /* operator-function-id, i.e. operator+(t).  */
+       d_advance (di, 2);
+
+      name = d_unqualified_name (di);
       if (name == NULL)
        return NULL;
       if (d_peek_char (di) == 'I')
@@ -2784,10 +2799,18 @@ d_expression (struct d_info *di)
          {
            struct demangle_component *left;
            struct demangle_component *right;
+           const char *code = op->u.s_operator.op->code;
 
            left = d_expression (di);
-           if (!strcmp (op->u.s_operator.op->code, "cl"))
+           if (!strcmp (code, "cl"))
              right = d_exprlist (di);
+           else if (!strcmp (code, "dt") || !strcmp (code, "pt"))
+             {
+               right = d_unqualified_name (di);
+               if (d_peek_char (di) == 'I')
+                 right = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE,
+                                      right, d_template_args (di));
+             }
            else
              right = d_expression (di);
 
@@ -4491,9 +4514,9 @@ d_print_mod (struct d_print_info *dpi,
       d_print_comp (dpi, d_left (mod));
       return;
     case DEMANGLE_COMPONENT_VECTOR_TYPE:
-      d_append_string (dpi, " vector[");
+      d_append_string (dpi, " __vector(");
       d_print_comp (dpi, d_left (mod));
-      d_append_char (dpi, ']');
+      d_append_char (dpi, ')');
       return;
 
     default: