OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [libiberty/] [cp-demangle.c] - Diff between revs 161 and 163

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 161 Rev 163
Line 415... Line 415...
 
 
static struct demangle_component *d_lambda (struct d_info *);
static struct demangle_component *d_lambda (struct d_info *);
 
 
static struct demangle_component *d_unnamed_type (struct d_info *);
static struct demangle_component *d_unnamed_type (struct d_info *);
 
 
 
static struct demangle_component *
 
d_clone_suffix (struct d_info *, struct demangle_component *);
 
 
static int
static int
d_add_substitution (struct d_info *, struct demangle_component *);
d_add_substitution (struct d_info *, struct demangle_component *);
 
 
static struct demangle_component *d_substitution (struct d_info *, int);
static struct demangle_component *d_substitution (struct d_info *, int);
 
 
Line 580... Line 583...
      printf ("reference temporary\n");
      printf ("reference temporary\n");
      break;
      break;
    case DEMANGLE_COMPONENT_HIDDEN_ALIAS:
    case DEMANGLE_COMPONENT_HIDDEN_ALIAS:
      printf ("hidden alias\n");
      printf ("hidden alias\n");
      break;
      break;
 
    case DEMANGLE_COMPONENT_TRANSACTION_CLONE:
 
      printf ("transaction clone\n");
 
      break;
 
    case DEMANGLE_COMPONENT_NONTRANSACTION_CLONE:
 
      printf ("non-transaction clone\n");
 
      break;
    case DEMANGLE_COMPONENT_RESTRICT:
    case DEMANGLE_COMPONENT_RESTRICT:
      printf ("restrict\n");
      printf ("restrict\n");
      break;
      break;
    case DEMANGLE_COMPONENT_VOLATILE:
    case DEMANGLE_COMPONENT_VOLATILE:
      printf ("volatile\n");
      printf ("volatile\n");
Line 727... Line 736...
                          struct demangle_component *name)
                          struct demangle_component *name)
{
{
  if (p == NULL
  if (p == NULL
      || name == NULL
      || name == NULL
      || (int) kind < gnu_v3_complete_object_ctor
      || (int) kind < gnu_v3_complete_object_ctor
      || (int) kind > gnu_v3_complete_object_allocating_ctor)
      || (int) kind > gnu_v3_object_ctor_group)
    return 0;
    return 0;
  p->type = DEMANGLE_COMPONENT_CTOR;
  p->type = DEMANGLE_COMPONENT_CTOR;
  p->u.s_ctor.kind = kind;
  p->u.s_ctor.kind = kind;
  p->u.s_ctor.name = name;
  p->u.s_ctor.name = name;
  return 1;
  return 1;
Line 746... Line 755...
                          struct demangle_component *name)
                          struct demangle_component *name)
{
{
  if (p == NULL
  if (p == NULL
      || name == NULL
      || name == NULL
      || (int) kind < gnu_v3_deleting_dtor
      || (int) kind < gnu_v3_deleting_dtor
      || (int) kind > gnu_v3_base_object_dtor)
      || (int) kind > gnu_v3_object_dtor_group)
    return 0;
    return 0;
  p->type = DEMANGLE_COMPONENT_DTOR;
  p->type = DEMANGLE_COMPONENT_DTOR;
  p->u.s_dtor.kind = kind;
  p->u.s_dtor.kind = kind;
  p->u.s_dtor.name = name;
  p->u.s_dtor.name = name;
  return 1;
  return 1;
Line 800... Line 809...
    case DEMANGLE_COMPONENT_TRINARY_ARG2:
    case DEMANGLE_COMPONENT_TRINARY_ARG2:
    case DEMANGLE_COMPONENT_LITERAL:
    case DEMANGLE_COMPONENT_LITERAL:
    case DEMANGLE_COMPONENT_LITERAL_NEG:
    case DEMANGLE_COMPONENT_LITERAL_NEG:
    case DEMANGLE_COMPONENT_COMPOUND_NAME:
    case DEMANGLE_COMPONENT_COMPOUND_NAME:
    case DEMANGLE_COMPONENT_VECTOR_TYPE:
    case DEMANGLE_COMPONENT_VECTOR_TYPE:
 
    case DEMANGLE_COMPONENT_CLONE:
      if (left == NULL || right == NULL)
      if (left == NULL || right == NULL)
        return NULL;
        return NULL;
      break;
      break;
 
 
      /* These types only require one parameter.  */
      /* These types only require one parameter.  */
Line 817... Line 827...
    case DEMANGLE_COMPONENT_COVARIANT_THUNK:
    case DEMANGLE_COMPONENT_COVARIANT_THUNK:
    case DEMANGLE_COMPONENT_JAVA_CLASS:
    case DEMANGLE_COMPONENT_JAVA_CLASS:
    case DEMANGLE_COMPONENT_GUARD:
    case DEMANGLE_COMPONENT_GUARD:
    case DEMANGLE_COMPONENT_REFTEMP:
    case DEMANGLE_COMPONENT_REFTEMP:
    case DEMANGLE_COMPONENT_HIDDEN_ALIAS:
    case DEMANGLE_COMPONENT_HIDDEN_ALIAS:
 
    case DEMANGLE_COMPONENT_TRANSACTION_CLONE:
 
    case DEMANGLE_COMPONENT_NONTRANSACTION_CLONE:
    case DEMANGLE_COMPONENT_POINTER:
    case DEMANGLE_COMPONENT_POINTER:
    case DEMANGLE_COMPONENT_REFERENCE:
    case DEMANGLE_COMPONENT_REFERENCE:
    case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
    case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
    case DEMANGLE_COMPONENT_COMPLEX:
    case DEMANGLE_COMPONENT_COMPLEX:
    case DEMANGLE_COMPONENT_IMAGINARY:
    case DEMANGLE_COMPONENT_IMAGINARY:
Line 1032... Line 1044...
      p->u.s_string.len = len;
      p->u.s_string.len = len;
    }
    }
  return p;
  return p;
}
}
 
 
/* <mangled-name> ::= _Z <encoding>
/* <mangled-name> ::= _Z <encoding> [<clone-suffix>]*
 
 
   TOP_LEVEL is non-zero when called at the top level.  */
   TOP_LEVEL is non-zero when called at the top level.  */
 
 
CP_STATIC_IF_GLIBCPP_V3
CP_STATIC_IF_GLIBCPP_V3
struct demangle_component *
struct demangle_component *
cplus_demangle_mangled_name (struct d_info *di, int top_level)
cplus_demangle_mangled_name (struct d_info *di, int top_level)
{
{
 
  struct demangle_component *p;
 
 
  if (! d_check_char (di, '_')
  if (! d_check_char (di, '_')
      /* Allow missing _ if not at toplevel to work around a
      /* Allow missing _ if not at toplevel to work around a
         bug in G++ abi-version=2 mangling; see the comment in
         bug in G++ abi-version=2 mangling; see the comment in
         write_template_arg.  */
         write_template_arg.  */
      && top_level)
      && top_level)
    return NULL;
    return NULL;
  if (! d_check_char (di, 'Z'))
  if (! d_check_char (di, 'Z'))
    return NULL;
    return NULL;
  return d_encoding (di, top_level);
  p = d_encoding (di, top_level);
 
 
 
  /* If at top level and parsing parameters, check for a clone
 
     suffix.  */
 
  if (top_level && (di->options & DMGL_PARAMS) != 0)
 
    while (d_peek_char (di) == '.'
 
           && (IS_LOWER (d_peek_next_char (di))
 
               || d_peek_next_char (di) == '_'
 
               || IS_DIGIT (d_peek_next_char (di))))
 
      p = d_clone_suffix (di, p);
 
 
 
  return p;
}
}
 
 
/* Return whether a function should have a return type.  The argument
/* Return whether a function should have a return type.  The argument
   is the function name, which may be qualified in various ways.  The
   is the function name, which may be qualified in various ways.  The
   rules are that template functions have return types with some
   rules are that template functions have return types with some
Line 1743... Line 1768...
                  ::= TF <type>
                  ::= TF <type>
                  ::= TJ <type>
                  ::= TJ <type>
                  ::= GR <name>
                  ::= GR <name>
                  ::= GA <encoding>
                  ::= GA <encoding>
                  ::= Gr <resource name>
                  ::= Gr <resource name>
 
                  ::= GTt <encoding>
 
                  ::= GTn <encoding>
*/
*/
 
 
static struct demangle_component *
static struct demangle_component *
d_special_name (struct d_info *di)
d_special_name (struct d_info *di)
{
{
Line 1827... Line 1854...
        {
        {
        case 'V':
        case 'V':
          return d_make_comp (di, DEMANGLE_COMPONENT_GUARD, d_name (di), NULL);
          return d_make_comp (di, DEMANGLE_COMPONENT_GUARD, d_name (di), NULL);
 
 
        case 'R':
        case 'R':
          return d_make_comp (di, DEMANGLE_COMPONENT_REFTEMP, d_name (di),
          {
                              NULL);
            struct demangle_component *name = d_name (di);
 
            return d_make_comp (di, DEMANGLE_COMPONENT_REFTEMP, name,
 
                                d_number_component (di));
 
          }
 
 
        case 'A':
        case 'A':
          return d_make_comp (di, DEMANGLE_COMPONENT_HIDDEN_ALIAS,
          return d_make_comp (di, DEMANGLE_COMPONENT_HIDDEN_ALIAS,
                              d_encoding (di, 0), NULL);
                              d_encoding (di, 0), NULL);
 
 
 
        case 'T':
 
          switch (d_next_char (di))
 
            {
 
            case 'n':
 
              return d_make_comp (di, DEMANGLE_COMPONENT_NONTRANSACTION_CLONE,
 
                                  d_encoding (di, 0), NULL);
 
            default:
 
              /* ??? The proposal is that other letters (such as 'h') stand
 
                 for different variants of transaction cloning, such as
 
                 compiling directly for hardware transaction support.  But
 
                 they still should all be transactional clones of some sort
 
                 so go ahead and call them that.  */
 
            case 't':
 
              return d_make_comp (di, DEMANGLE_COMPONENT_TRANSACTION_CLONE,
 
                                  d_encoding (di, 0), NULL);
 
            }
 
 
        case 'r':
        case 'r':
          return d_java_resource (di);
          return d_java_resource (di);
 
 
        default:
        default:
          return NULL;
          return NULL;
Line 1917... Line 1964...
            kind = gnu_v3_base_object_ctor;
            kind = gnu_v3_base_object_ctor;
            break;
            break;
          case '3':
          case '3':
            kind = gnu_v3_complete_object_allocating_ctor;
            kind = gnu_v3_complete_object_allocating_ctor;
            break;
            break;
 
          case '5':
 
            kind = gnu_v3_object_ctor_group;
 
            break;
          default:
          default:
            return NULL;
            return NULL;
          }
          }
        d_advance (di, 2);
        d_advance (di, 2);
        return d_make_ctor (di, kind, di->last_name);
        return d_make_ctor (di, kind, di->last_name);
Line 1939... Line 1989...
            kind = gnu_v3_complete_object_dtor;
            kind = gnu_v3_complete_object_dtor;
            break;
            break;
          case '2':
          case '2':
            kind = gnu_v3_base_object_dtor;
            kind = gnu_v3_base_object_dtor;
            break;
            break;
 
          case '5':
 
            kind = gnu_v3_object_dtor_group;
 
            break;
          default:
          default:
            return NULL;
            return NULL;
          }
          }
        d_advance (di, 2);
        d_advance (di, 2);
        return d_make_dtor (di, kind, di->last_name);
        return d_make_dtor (di, kind, di->last_name);
Line 2275... Line 2328...
 
 
static struct demangle_component **
static struct demangle_component **
d_cv_qualifiers (struct d_info *di,
d_cv_qualifiers (struct d_info *di,
                 struct demangle_component **pret, int member_fn)
                 struct demangle_component **pret, int member_fn)
{
{
 
  struct demangle_component **pstart;
  char peek;
  char peek;
 
 
 
  pstart = pret;
  peek = d_peek_char (di);
  peek = d_peek_char (di);
  while (peek == 'r' || peek == 'V' || peek == 'K')
  while (peek == 'r' || peek == 'V' || peek == 'K')
    {
    {
      enum demangle_component_type t;
      enum demangle_component_type t;
 
 
Line 2313... Line 2368...
      pret = &d_left (*pret);
      pret = &d_left (*pret);
 
 
      peek = d_peek_char (di);
      peek = d_peek_char (di);
    }
    }
 
 
 
  if (!member_fn && peek == 'F')
 
    {
 
      while (pstart != pret)
 
        {
 
          switch ((*pstart)->type)
 
            {
 
            case DEMANGLE_COMPONENT_RESTRICT:
 
              (*pstart)->type = DEMANGLE_COMPONENT_RESTRICT_THIS;
 
              break;
 
            case DEMANGLE_COMPONENT_VOLATILE:
 
              (*pstart)->type = DEMANGLE_COMPONENT_VOLATILE_THIS;
 
              break;
 
            case DEMANGLE_COMPONENT_CONST:
 
              (*pstart)->type = DEMANGLE_COMPONENT_CONST_THIS;
 
              break;
 
            default:
 
              break;
 
            }
 
          pstart = &d_left (*pstart);
 
        }
 
    }
 
 
  return pret;
  return pret;
}
}
 
 
/* <function-type> ::= F [Y] <bare-function-type> E  */
/* <function-type> ::= F [Y] <bare-function-type> E  */
 
 
Line 2352... Line 2429...
  while (1)
  while (1)
    {
    {
      struct demangle_component *type;
      struct demangle_component *type;
 
 
      char peek = d_peek_char (di);
      char peek = d_peek_char (di);
      if (peek == '\0' || peek == 'E')
      if (peek == '\0' || peek == 'E' || peek == '.')
        break;
        break;
      type = cplus_demangle_type (di);
      type = cplus_demangle_type (di);
      if (type == NULL)
      if (type == NULL)
        return NULL;
        return NULL;
      *ptl = d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, type, NULL);
      *ptl = d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, type, NULL);
Line 3080... Line 3157...
    return NULL;
    return NULL;
 
 
  return ret;
  return ret;
}
}
 
 
 
/* <clone-suffix> ::= [ . <clone-type-identifier> ] [ . <nonnegative number> ]*
 
*/
 
 
 
static struct demangle_component *
 
d_clone_suffix (struct d_info *di, struct demangle_component *encoding)
 
{
 
  const char *suffix = d_str (di);
 
  const char *pend = suffix;
 
  struct demangle_component *n;
 
 
 
  if (*pend == '.' && (IS_LOWER (pend[1]) || pend[1] == '_'))
 
    {
 
      pend += 2;
 
      while (IS_LOWER (*pend) || *pend == '_')
 
        ++pend;
 
    }
 
  while (*pend == '.' && IS_DIGIT (pend[1]))
 
    {
 
      pend += 2;
 
      while (IS_DIGIT (*pend))
 
        ++pend;
 
    }
 
  d_advance (di, pend - suffix);
 
  n = d_make_name (di, suffix, pend - suffix);
 
  return d_make_comp (di, DEMANGLE_COMPONENT_CLONE, encoding, n);
 
}
 
 
/* Add a new substitution.  */
/* Add a new substitution.  */
 
 
static int
static int
d_add_substitution (struct d_info *di, struct demangle_component *dc)
d_add_substitution (struct d_info *di, struct demangle_component *dc)
{
{
Line 3851... Line 3955...
      d_append_string (dpi, "guard variable for ");
      d_append_string (dpi, "guard variable for ");
      d_print_comp (dpi, options, d_left (dc));
      d_print_comp (dpi, options, d_left (dc));
      return;
      return;
 
 
    case DEMANGLE_COMPONENT_REFTEMP:
    case DEMANGLE_COMPONENT_REFTEMP:
      d_append_string (dpi, "reference temporary for ");
      d_append_string (dpi, "reference temporary #");
 
      d_print_comp (dpi, options, d_right (dc));
 
      d_append_string (dpi, " for ");
      d_print_comp (dpi, options, d_left (dc));
      d_print_comp (dpi, options, d_left (dc));
      return;
      return;
 
 
    case DEMANGLE_COMPONENT_HIDDEN_ALIAS:
    case DEMANGLE_COMPONENT_HIDDEN_ALIAS:
      d_append_string (dpi, "hidden alias for ");
      d_append_string (dpi, "hidden alias for ");
      d_print_comp (dpi, options, d_left (dc));
      d_print_comp (dpi, options, d_left (dc));
      return;
      return;
 
 
 
    case DEMANGLE_COMPONENT_TRANSACTION_CLONE:
 
      d_append_string (dpi, "transaction clone for ");
 
      d_print_comp (dpi, options, d_left (dc));
 
      return;
 
 
 
    case DEMANGLE_COMPONENT_NONTRANSACTION_CLONE:
 
      d_append_string (dpi, "non-transaction clone for ");
 
      d_print_comp (dpi, options, d_left (dc));
 
      return;
 
 
    case DEMANGLE_COMPONENT_SUB_STD:
    case DEMANGLE_COMPONENT_SUB_STD:
      d_append_buffer (dpi, dc->u.s_string.string, dc->u.s_string.len);
      d_append_buffer (dpi, dc->u.s_string.string, dc->u.s_string.len);
      return;
      return;
 
 
    case DEMANGLE_COMPONENT_RESTRICT:
    case DEMANGLE_COMPONENT_RESTRICT:
Line 4461... Line 4577...
      d_append_string (dpi, "{unnamed type#");
      d_append_string (dpi, "{unnamed type#");
      d_append_num (dpi, dc->u.s_number.number + 1);
      d_append_num (dpi, dc->u.s_number.number + 1);
      d_append_char (dpi, '}');
      d_append_char (dpi, '}');
      return;
      return;
 
 
 
    case DEMANGLE_COMPONENT_CLONE:
 
      d_print_comp (dpi, options, d_left (dc));
 
      d_append_string (dpi, " [clone ");
 
      d_print_comp (dpi, options, d_right (dc));
 
      d_append_char (dpi, ']');
 
      return;
 
 
    default:
    default:
      d_print_error (dpi);
      d_print_error (dpi);
      return;
      return;
    }
    }
}
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.