(add_matching_methods): Reove destructor special case.
(find_method): Call find_methods directly instead of
collect_methods.
* valops.c (value_struct_elt): Remove destructor
special cases.
(check_field): Likewise.
(value_struct_elt_for_reference): Likewise.
(destructor_name_p): Remove misleading comment about dtors
being "special cases".
* gdbtypes.h (get_destructor_fn_field): Remove. No longer needed.
* gdbtypes.c (get_destructor_fn_field): Likewise.
+2009-06-16 Keith Seitz <keiths@redhat.com>
+
+ * linespec.c (collect_methods): Delete.
+ (add_matching_methods): Reove destructor special case.
+ (find_method): Call find_methods directly instead of
+ collect_methods.
+ * valops.c (value_struct_elt): Remove destructor
+ special cases.
+ (check_field): Likewise.
+ (value_struct_elt_for_reference): Likewise.
+ (destructor_name_p): Remove misleading comment about dtors
+ being "special cases".
+ * gdbtypes.h (get_destructor_fn_field): Remove. No longer needed.
+ * gdbtypes.c (get_destructor_fn_field): Likewise.
+
2009-06-16 Pedro Alves <pedro@codesourcery.com>
* mi/mi-main.c (mi_cmd_data_read_memory): Dispatch
}
}
-/* Find the method and field indices for the destructor in class type T.
- Return 1 if the destructor was found, otherwise, return 0. */
-
-int
-get_destructor_fn_field (struct type *t,
- int *method_indexp,
- int *field_indexp)
-{
- int i;
-
- for (i = 0; i < TYPE_NFN_FIELDS (t); i++)
- {
- int j;
- struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
-
- for (j = 0; j < TYPE_FN_FIELDLIST_LENGTH (t, i); j++)
- {
- if (is_destructor_name (TYPE_FN_FIELD_PHYSNAME (f, j)) != 0)
- {
- *method_indexp = i;
- *field_indexp = j;
- return 1;
- }
- }
- }
- return 0;
-}
-
static void
stub_noname_complaint (void)
{
extern int get_vptr_fieldno (struct type *, struct type **);
-extern int get_destructor_fn_field (struct type *, int *, int *);
-
extern int get_discrete_bounds (struct type *, LONGEST *, LONGEST *);
extern int is_ancestor (struct type *, struct type *);
struct type *t,
struct symbol *sym_class);
-static int collect_methods (char *copy, struct type *t,
- struct symbol *sym_class,
- struct symbol **sym_arr);
-
static NORETURN void cplusplus_error (const char *name,
const char *fmt, ...)
ATTR_NORETURN ATTR_FORMAT (printf, 2, 3);
else
phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
- /* Destructor is handled by caller, don't add it to
- the list. */
- if (is_destructor_name (phys_name) != 0)
- continue;
-
sym_arr[i1] = lookup_symbol_in_language (phys_name,
NULL, VAR_DOMAIN,
language,
p = skip_quoted (*argptr);
}
+ /* Keep any template parameters */
+ if (*p == '<')
+ p = find_template_name_end (p);
+
copy = (char *) alloca (p - *argptr + 1);
memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = '\0';
/* Find all methods with a matching name, and put them in
sym_arr. */
- i1 = collect_methods (copy, t, sym_class, sym_arr);
+ i1 = find_methods (t, copy, SYMBOL_LANGUAGE (sym_class), sym_arr);
if (i1 == 1)
{
}
}
-/* Find all methods named COPY in the class whose type is T, and put
- them in SYM_ARR. Return the number of methods found. */
-
-static int
-collect_methods (char *copy, struct type *t,
- struct symbol *sym_class, struct symbol **sym_arr)
-{
- int i1 = 0; /* Counter for the symbol array. */
-
- if (destructor_name_p (copy, t))
- {
- /* Destructors are a special case. */
- int m_index, f_index;
-
- if (get_destructor_fn_field (t, &m_index, &f_index))
- {
- struct fn_field *f = TYPE_FN_FIELDLIST1 (t, m_index);
-
- sym_arr[i1] =
- lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, f_index),
- NULL, VAR_DOMAIN, (int *) NULL);
- if (sym_arr[i1])
- i1++;
- }
- }
- else
- i1 = find_methods (t, copy, SYMBOL_LANGUAGE (sym_class), sym_arr);
-
- return i1;
-}
-
\f
/* Return the symtab associated to the filename given by the substring
/* C++: If it was not found as a data field, then try to
return it as a pointer to a method. */
-
- if (destructor_name_p (name, t))
- error (_("Cannot get value of destructor"));
-
v = search_struct_method (name, argp, args, 0,
static_memfuncp, t);
return v;
}
- if (destructor_name_p (name, t))
- {
- if (!args[1])
- {
- /* Destructors are a special case. */
- int m_index, f_index;
-
- v = NULL;
- if (get_destructor_fn_field (t, &m_index, &f_index))
- {
- v = value_fn_field (NULL,
- TYPE_FN_FIELDLIST1 (t, m_index),
- f_index, NULL, 0);
- }
- if (v == NULL)
- error (_("could not find destructor function named %s."),
- name);
- else
- return v;
- }
- else
- {
- error (_("destructor should not have any argument"));
- }
- }
- else
v = search_struct_method (name, argp, args, 0,
static_memfuncp, t);
int
destructor_name_p (const char *name, const struct type *type)
{
- /* Destructors are a special case. */
-
if (name[0] == '~')
{
char *dname = type_name_no_tag (type);
/* C++: If it was not found as a data field, then try to return it
as a pointer to a method. */
- /* Destructors are a special case. */
- if (destructor_name_p (name, type))
- {
- int m_index, f_index;
-
- return get_destructor_fn_field (type, &m_index, &f_index);
- }
-
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i)
{
if (strcmp_iw (TYPE_FN_FIELDLIST_NAME (type, i), name) == 0)
/* C++: If it was not found as a data field, then try to return it
as a pointer to a method. */
- /* Destructors are a special case. */
- if (destructor_name_p (name, t))
- {
- error (_("member pointers to destructors not implemented yet"));
- }
-
/* Perform all necessary dereferencing. */
while (intype && TYPE_CODE (intype) == TYPE_CODE_PTR)
intype = TYPE_TARGET_TYPE (intype);