contrib/gdb-7/gdb/linespec.c
static void
find_methods (struct type *t, const char *name,
	      VEC (const_char_ptr) **result_names,
	      VEC (typep) **superclasses)
{
  int i1 = 0;
  int ibase;
  char *class_name = type_name_no_tag (t);
  char *canon;

  /* Ignore this class if it doesn't have a name.  This is ugly, but
     unless we figure out how to get the physname without the name of
     the class, then the loop can't do any good.  */
  if (class_name)
    {
      int method_counter;
      int name_len = strlen (name);

      CHECK_TYPEDEF (t);

      /* Loop over each method name.  At this level, all overloads of a name
         are counted as a single name.  There is an inner loop which loops over
         each overload.  */

      for (method_counter = TYPE_NFN_FIELDS (t) - 1;
	   method_counter >= 0;
	   --method_counter)
	{
	  char *method_name = TYPE_FN_FIELDLIST_NAME (t, method_counter);
	  char dem_opname[64];

	  if (strncmp (method_name, "__", 2) == 0 ||
	      strncmp (method_name, "op", 2) == 0 ||
	      strncmp (method_name, "type", 4) == 0)
	    {
	      if (cplus_demangle_opname (method_name, dem_opname, DMGL_ANSI))
		method_name = dem_opname;
	      else if (cplus_demangle_opname (method_name, dem_opname, 0))
		method_name = dem_opname;
	    }

	  if (strcmp_iw (method_name, name) == 0)
	    {
	      int field_counter;

	      for (field_counter = (TYPE_FN_FIELDLIST_LENGTH (t, method_counter)
				    - 1);
		   field_counter >= 0;
		   --field_counter)
		{
		  struct fn_field *f;
		  const char *phys_name;

		  f = TYPE_FN_FIELDLIST1 (t, method_counter);
		  if (TYPE_FN_FIELD_STUB (f, field_counter))
		    continue;
		  phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
		  VEC_safe_push (const_char_ptr, *result_names, phys_name);
		}
	    }
	}
    }

  for (ibase = 0; ibase < TYPE_N_BASECLASSES (t); ibase++)
    VEC_safe_push (typep, *superclasses, TYPE_BASECLASS (t, ibase));
}
/* A helper for find_method.  This finds all methods in type T which
   match NAME.  It adds resulting symbol names to RESULT_NAMES, and
   adds T's direct superclasses to SUPERCLASSES.  */
A helper for find_method.  This finds all methods in type T which
match NAME.  It adds resulting symbol names to RESULT_NAMES, and
adds T's direct superclasses to SUPERCLASSES.
A helper for find_method . This finds all methods in type T which match NAME . It adds resulting symbol names to RESULT_NAMES and adds T ' s direct superclasses to SUPERCLASSES .
static void
find_methods (struct type *t, const char *name,
	      VEC (const_char_ptr) **result_names,
	      VEC (typep) **superclasses)
{
  int i1 = 0;
  int ibase;
  char *class_name = type_name_no_tag (t);
  char *canon;
  if (class_name)
    {
      int method_counter;
      int name_len = strlen (name);
      CHECK_TYPEDEF (t);
      for (method_counter = TYPE_NFN_FIELDS (t) - 1;
	   method_counter >= 0;
	   --method_counter)
	{
	  char *method_name = TYPE_FN_FIELDLIST_NAME (t, method_counter);
	  char dem_opname[64];
	  if (strncmp (method_name, "__", 2) == 0 ||
	      strncmp (method_name, "op", 2) == 0 ||
	      strncmp (method_name, "type", 4) == 0)
	    {
	      if (cplus_demangle_opname (method_name, dem_opname, DMGL_ANSI))
		method_name = dem_opname;
	      else if (cplus_demangle_opname (method_name, dem_opname, 0))
		method_name = dem_opname;
	    }
	  if (strcmp_iw (method_name, name) == 0)
	    {
	      int field_counter;
	      for (field_counter = (TYPE_FN_FIELDLIST_LENGTH (t, method_counter)
				    - 1);
		   field_counter >= 0;
		   --field_counter)
		{
		  struct fn_field *f;
		  const char *phys_name;
		  f = TYPE_FN_FIELDLIST1 (t, method_counter);
		  if (TYPE_FN_FIELD_STUB (f, field_counter))
		    continue;
		  phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
		  VEC_safe_push (const_char_ptr, *result_names, phys_name);
		}
	    }
	}
    }
  for (ibase = 0; ibase < TYPE_N_BASECLASSES (t); ibase++)
    VEC_safe_push (typep, *superclasses, TYPE_BASECLASS (t, ibase));
}
static void find_methods ( struct type * t , const char * name , VEC ( const_char_ptr ) * * result_names , VEC ( typep ) * * superclasses ) { int i1 = 0 ; int ibase ; char * class_name = type_name_no_tag ( t ) ; char * canon ; if ( class_name ) { int method_counter ; int name_len = strlen ( name ) ; CHECK_TYPEDEF ( t ) ; for ( method_counter = TYPE_NFN_FIELDS ( t ) - 1 ; method_counter >= 0 ; -- method_counter ) { char * method_name = TYPE_FN_FIELDLIST_NAME ( t , method_counter ) ; char dem_opname [ 64 ] ; if ( strncmp ( method_name , " " , 2 ) == 0 || strncmp ( method_name , " " , 2 ) == 0 || strncmp ( method_name , " " , 4 ) == 0 ) { if ( cplus_demangle_opname ( method_name , dem_opname , DMGL_ANSI ) ) method_name = dem_opname ; else if ( cplus_demangle_opname ( method_name , dem_opname , 0 ) ) method_name = dem_opname ; } if ( strcmp_iw ( method_name , name ) == 0 ) { int field_counter ; for ( field_counter = ( TYPE_FN_FIELDLIST_LENGTH ( t , method_counter ) - 1 ) ; field_counter >= 0 ; -- field_counter ) { struct fn_field * f ; const char * phys_name ; f = TYPE_FN_FIELDLIST1 ( t , method_counter ) ; if ( TYPE_FN_FIELD_STUB ( f , field_counter ) ) continue ; phys_name = TYPE_FN_FIELD_PHYSNAME ( f , field_counter ) ; VEC_safe_push ( const_char_ptr , * result_names , phys_name ) ; } } } } for ( ibase = 0 ; ibase < TYPE_N_BASECLASSES ( t ) ; ibase ++ ) VEC_safe_push ( typep , * superclasses , TYPE_BASECLASS ( t , ibase ) ) ; }
A helper for find_method.
A helper for find_method .
/* Ignore this class if it doesn't have a name.  This is ugly, but
     unless we figure out how to get the physname without the name of
     the class, then the loop can't do any good.  */ /* Loop over each method name.  At this level, all overloads of a name
         are counted as a single name.  There is an inner loop which loops over
         each overload.  */