Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Enumerations | Functions | Variables
cp-demangle.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  demangle_operator_info
struct  demangle_builtin_type_info
struct  d_info

Defines

#define d_peek_char(di)   (*((di)->n))
#define d_peek_next_char(di)   ((di)->n[1])
#define d_advance(di, i)   ((di)->n += (i))
#define d_check_char(di, c)   (d_peek_char(di) == c ? ((di)->n++, 1) : 0)
#define d_next_char(di)   (d_peek_char(di) == '\0' ? '\0' : *((di)->n++))
#define d_str(di)   ((di)->n)
#define CP_STATIC_IF_GLIBCPP_V3   extern
#define D_BUILTIN_TYPE_COUNT   (26)

Enumerations

enum  d_builtin_type_print {
  D_PRINT_DEFAULT, D_PRINT_INT, D_PRINT_UNSIGNED, D_PRINT_LONG,
  D_PRINT_UNSIGNED_LONG, D_PRINT_LONG_LONG, D_PRINT_UNSIGNED_LONG_LONG, D_PRINT_BOOL,
  D_PRINT_FLOAT, D_PRINT_VOID
}

Functions

CP_STATIC_IF_GLIBCPP_V3 struct
demangle_component
cplus_demangle_mangled_name (struct d_info *, int)
CP_STATIC_IF_GLIBCPP_V3 struct
demangle_component
cplus_demangle_type (struct d_info *)
void cplus_demangle_init_info (const char *, int, size_t, struct d_info *)

Variables

CP_STATIC_IF_GLIBCPP_V3 struct demangle_builtin_type_info [D_BUILTIN_TYPE_COUNT]

Class Documentation

struct demangle_operator_info

Definition at line 36 of file cp-demangle.h.

Class Members
int args
const char * code
int len
const char * name
struct demangle_builtin_type_info

Definition at line 76 of file cp-demangle.h.

Class Members
int java_len
const char * java_name
int len
const char * name
struct d_info

Definition at line 92 of file cp-demangle.h.

Collaboration diagram for d_info:
Class Members
struct demangle_component * comps
int did_subs
int expansion
struct demangle_component * last_name
const char * n
int next_comp
int next_sub
int num_comps
int num_subs
int options
const char * s
const char * send
struct demangle_component ** subs

Define Documentation

#define CP_STATIC_IF_GLIBCPP_V3   extern

Definition at line 143 of file cp-demangle.h.

#define d_advance (   di,
  i 
)    ((di)->n += (i))

Definition at line 133 of file cp-demangle.h.

#define D_BUILTIN_TYPE_COUNT   (26)

Definition at line 150 of file cp-demangle.h.

#define d_check_char (   di,
  c 
)    (d_peek_char(di) == c ? ((di)->n++, 1) : 0)

Definition at line 134 of file cp-demangle.h.

#define d_next_char (   di)    (d_peek_char(di) == '\0' ? '\0' : *((di)->n++))

Definition at line 135 of file cp-demangle.h.

#define d_peek_char (   di)    (*((di)->n))

Definition at line 131 of file cp-demangle.h.

#define d_peek_next_char (   di)    ((di)->n[1])

Definition at line 132 of file cp-demangle.h.

#define d_str (   di)    ((di)->n)

Definition at line 136 of file cp-demangle.h.


Enumeration Type Documentation

Enumerator:
D_PRINT_DEFAULT 
D_PRINT_INT 
D_PRINT_UNSIGNED 
D_PRINT_LONG 
D_PRINT_UNSIGNED_LONG 
D_PRINT_LONG_LONG 
D_PRINT_UNSIGNED_LONG_LONG 
D_PRINT_BOOL 
D_PRINT_FLOAT 
D_PRINT_VOID 

Definition at line 50 of file cp-demangle.h.

{
  /* Print as (type)val.  */
  D_PRINT_DEFAULT,
  /* Print as integer.  */
  D_PRINT_INT,
  /* Print as unsigned integer, with trailing "u".  */
  D_PRINT_UNSIGNED,
  /* Print as long, with trailing "l".  */
  D_PRINT_LONG,
  /* Print as unsigned long, with trailing "ul".  */
  D_PRINT_UNSIGNED_LONG,
  /* Print as long long, with trailing "ll".  */
  D_PRINT_LONG_LONG,
  /* Print as unsigned long long, with trailing "ull".  */
  D_PRINT_UNSIGNED_LONG_LONG,
  /* Print as bool.  */
  D_PRINT_BOOL,
  /* Print as float--put value in square brackets.  */
  D_PRINT_FLOAT,
  /* Print in usual way, but here to detect void.  */
  D_PRINT_VOID
};

Function Documentation

void cplus_demangle_init_info ( const char *  ,
int  ,
size_t  ,
struct d_info  
)

Definition at line 3908 of file cp-demangle.c.

{
  di->s = mangled;
  di->send = mangled + len;
  di->options = options;

  di->n = mangled;

  /* We can not need more components than twice the number of chars in
     the mangled string.  Most components correspond directly to
     chars, but the ARGLIST types are exceptions.  */
  di->num_comps = 2 * len;
  di->next_comp = 0;

  /* Similarly, we can not need more substitutions than there are
     chars in the mangled string.  */
  di->num_subs = len;
  di->next_sub = 0;
  di->did_subs = 0;

  di->last_name = NULL;

  di->expansion = 0;
}

Here is the caller graph for this function:

Definition at line 960 of file cp-demangle.c.

{
  if (! d_check_char (di, '_'))
    return NULL;
  if (! d_check_char (di, 'Z'))
    return NULL;
  return d_encoding (di, top_level);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1753 of file cp-demangle.c.

{
  char peek;
  struct demangle_component *ret;
  int can_subst;

  /* The ABI specifies that when CV-qualifiers are used, the base type
     is substitutable, and the fully qualified type is substitutable,
     but the base type with a strict subset of the CV-qualifiers is
     not substitutable.  The natural recursive implementation of the
     CV-qualifiers would cause subsets to be substitutable, so instead
     we pull them all off now.

     FIXME: The ABI says that order-insensitive vendor qualifiers
     should be handled in the same way, but we have no way to tell
     which vendor qualifiers are order-insensitive and which are
     order-sensitive.  So we just assume that they are all
     order-sensitive.  g++ 3.4 supports only one vendor qualifier,
     __vector, and it treats it as order-sensitive when mangling
     names.  */

  peek = d_peek_char (di);
  if (peek == 'r' || peek == 'V' || peek == 'K')
    {
      struct demangle_component **pret;

      pret = d_cv_qualifiers (di, &ret, 0);
      if (pret == NULL)
       return NULL;
      *pret = cplus_demangle_type (di);
      if (! *pret || ! d_add_substitution (di, ret))
       return NULL;
      return ret;
    }

  can_subst = 1;

  switch (peek)
    {
    case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g':
    case 'h': case 'i': case 'j':           case 'l': case 'm': case 'n':
    case 'o':                               case 's': case 't':
    case 'v': case 'w': case 'x': case 'y': case 'z':
      ret = d_make_builtin_type (di,
                             &cplus_demangle_builtin_types[peek - 'a']);
      di->expansion += ret->u.s_builtin.type->len;
      can_subst = 0;
      d_advance (di, 1);
      break;

    case 'u':
      d_advance (di, 1);
      ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE,
                      d_source_name (di), NULL);
      break;

    case 'F':
      ret = d_function_type (di);
      break;

    case '0': case '1': case '2': case '3': case '4':
    case '5': case '6': case '7': case '8': case '9':
    case 'N':
    case 'Z':
      ret = d_class_enum_type (di);
      break;

    case 'A':
      ret = d_array_type (di);
      break;

    case 'M':
      ret = d_pointer_to_member_type (di);
      break;

    case 'T':
      ret = d_template_param (di);
      if (d_peek_char (di) == 'I')
       {
         /* This is <template-template-param> <template-args>.  The
            <template-template-param> part is a substitution
            candidate.  */
         if (! d_add_substitution (di, ret))
           return NULL;
         ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
                          d_template_args (di));
       }
      break;

    case 'S':
      /* If this is a special substitution, then it is the start of
        <class-enum-type>.  */
      {
       char peek_next;

       peek_next = d_peek_next_char (di);
       if (IS_DIGIT (peek_next)
           || peek_next == '_'
           || IS_UPPER (peek_next))
         {
           ret = d_substitution (di, 0);
           /* The substituted name may have been a template name and
              may be followed by tepmlate args.  */
           if (d_peek_char (di) == 'I')
             ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
                             d_template_args (di));
           else
             can_subst = 0;
         }
       else
         {
           ret = d_class_enum_type (di);
           /* If the substitution was a complete type, then it is not
              a new substitution candidate.  However, if the
              substitution was followed by template arguments, then
              the whole thing is a substitution candidate.  */
           if (ret != NULL && ret->type == DEMANGLE_COMPONENT_SUB_STD)
             can_subst = 0;
         }
      }
      break;

    case 'P':
      d_advance (di, 1);
      ret = d_make_comp (di, DEMANGLE_COMPONENT_POINTER,
                      cplus_demangle_type (di), NULL);
      break;

    case 'R':
      d_advance (di, 1);
      ret = d_make_comp (di, DEMANGLE_COMPONENT_REFERENCE,
                      cplus_demangle_type (di), NULL);
      break;

    case 'C':
      d_advance (di, 1);
      ret = d_make_comp (di, DEMANGLE_COMPONENT_COMPLEX,
                      cplus_demangle_type (di), NULL);
      break;

    case 'G':
      d_advance (di, 1);
      ret = d_make_comp (di, DEMANGLE_COMPONENT_IMAGINARY,
                      cplus_demangle_type (di), NULL);
      break;

    case 'U':
      d_advance (di, 1);
      ret = d_source_name (di);
      ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL,
                      cplus_demangle_type (di), ret);
      break;

    default:
      return NULL;
    }

  if (can_subst)
    {
      if (! d_add_substitution (di, ret))
       return NULL;
    }

  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 153 of file cp-demangle.h.