aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2009-06-16 18:39:41 +0000
committerKeith Seitz <keiths@redhat.com>2009-06-16 18:39:41 +0000
commit19ef5c713c0116f2e15fea28168614d7894b613a (patch)
treecf913c08263d2b8aa2a3389dc7f9c2220f70389d
parenta42616899b4f89a1bc1177c8edb27e890af40a82 (diff)
downloadgdb-19ef5c713c0116f2e15fea28168614d7894b613a.zip
gdb-19ef5c713c0116f2e15fea28168614d7894b613a.tar.gz
gdb-19ef5c713c0116f2e15fea28168614d7894b613a.tar.bz2
* 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.
-rw-r--r--gdb/ChangeLog15
-rw-r--r--gdb/gdbtypes.c28
-rw-r--r--gdb/gdbtypes.h2
-rw-r--r--gdb/linespec.c46
-rw-r--r--gdb/valops.c46
5 files changed, 20 insertions, 117 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 812b83e..1cc0cb2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,18 @@
+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
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index f415773..63f2e35 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1334,34 +1334,6 @@ get_vptr_fieldno (struct type *type, struct type **basetypep)
}
}
-/* 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)
{
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index fc54acc..522d26f 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1202,8 +1202,6 @@ extern struct type *lookup_template_type (char *, struct type *,
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 *);
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 3d0ceed..9c10156 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -76,10 +76,6 @@ static struct symtabs_and_lines find_method (int funfirstline,
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);
@@ -306,11 +302,6 @@ add_matching_methods (int method_counter, struct type *t,
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,
@@ -849,6 +840,10 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
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';
@@ -1441,7 +1436,7 @@ find_method (int funfirstline, char ***canonical, char *saved_arg,
/* 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)
{
@@ -1492,37 +1487,6 @@ find_method (int funfirstline, char ***canonical, char *saved_arg,
}
}
-/* 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;
-}
-
/* Return the symtab associated to the filename given by the substring
diff --git a/gdb/valops.c b/gdb/valops.c
index 5907d96..5530f55 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1849,10 +1849,6 @@ value_struct_elt (struct value **argp, struct value **args,
/* 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);
@@ -1868,32 +1864,6 @@ value_struct_elt (struct value **argp, struct value **args,
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);
@@ -2499,8 +2469,6 @@ classify_oload_match (struct badness_vector *oload_champ_bv,
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);
@@ -2539,14 +2507,6 @@ check_field (struct type *type, const char *name)
/* 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)
@@ -2642,12 +2602,6 @@ value_struct_elt_for_reference (struct type *domain, int offset,
/* 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);