2003-06-02 David Carlton <carlton@bactrian.org>
* linespec.c (find_methods): Break out code into add_matching_methods and add_constructors. (add_matching_methods): New. (add_constructors): Ditto.
This commit is contained in:
parent
bf7488d21d
commit
aee8d8ba8a
2 changed files with 124 additions and 80 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2003-06-02 David Carlton <carlton@bactrian.org>
|
||||||
|
|
||||||
|
* linespec.c (find_methods): Break out code into
|
||||||
|
add_matching_methods and add_constructors.
|
||||||
|
(add_matching_methods): New.
|
||||||
|
(add_constructors): Ditto.
|
||||||
|
|
||||||
2003-06-02 Andrew Cagney <cagney@redhat.com>
|
2003-06-02 Andrew Cagney <cagney@redhat.com>
|
||||||
|
|
||||||
* alpha-tdep.c (alpha_gdbarch_init): Set convert_register_p,
|
* alpha-tdep.c (alpha_gdbarch_init): Set convert_register_p,
|
||||||
|
|
|
@ -82,6 +82,12 @@ static int total_number_of_methods (struct type *type);
|
||||||
|
|
||||||
static int find_methods (struct type *, char *, struct symbol **);
|
static int find_methods (struct type *, char *, struct symbol **);
|
||||||
|
|
||||||
|
static int add_matching_methods (int method_counter, struct type *t,
|
||||||
|
struct symbol **sym_arr);
|
||||||
|
|
||||||
|
static int add_constructors (int method_counter, struct type *t,
|
||||||
|
struct symbol **sym_arr);
|
||||||
|
|
||||||
static void build_canonical_line_spec (struct symtab_and_line *,
|
static void build_canonical_line_spec (struct symtab_and_line *,
|
||||||
char *, char ***);
|
char *, char ***);
|
||||||
|
|
||||||
|
@ -210,7 +216,6 @@ find_methods (struct type *t, char *name, struct symbol **sym_arr)
|
||||||
method_counter >= 0;
|
method_counter >= 0;
|
||||||
--method_counter)
|
--method_counter)
|
||||||
{
|
{
|
||||||
int field_counter;
|
|
||||||
char *method_name = TYPE_FN_FIELDLIST_NAME (t, method_counter);
|
char *method_name = TYPE_FN_FIELDLIST_NAME (t, method_counter);
|
||||||
char dem_opname[64];
|
char dem_opname[64];
|
||||||
|
|
||||||
|
@ -226,6 +231,45 @@ find_methods (struct type *t, char *name, struct symbol **sym_arr)
|
||||||
|
|
||||||
if (strcmp_iw (name, method_name) == 0)
|
if (strcmp_iw (name, method_name) == 0)
|
||||||
/* Find all the overloaded methods with that name. */
|
/* Find all the overloaded methods with that name. */
|
||||||
|
i1 += add_matching_methods (method_counter, t,
|
||||||
|
sym_arr + i1);
|
||||||
|
else if (strncmp (class_name, name, name_len) == 0
|
||||||
|
&& (class_name[name_len] == '\0'
|
||||||
|
|| class_name[name_len] == '<'))
|
||||||
|
i1 += add_constructors (method_counter, t,
|
||||||
|
sym_arr + i1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Only search baseclasses if there is no match yet, since names in
|
||||||
|
derived classes override those in baseclasses.
|
||||||
|
|
||||||
|
FIXME: The above is not true; it is only true of member functions
|
||||||
|
if they have the same number of arguments (??? - section 13.1 of the
|
||||||
|
ARM says the function members are not in the same scope but doesn't
|
||||||
|
really spell out the rules in a way I understand. In any case, if
|
||||||
|
the number of arguments differ this is a case in which we can overload
|
||||||
|
rather than hiding without any problem, and gcc 2.4.5 does overload
|
||||||
|
rather than hiding in this case). */
|
||||||
|
|
||||||
|
if (i1 == 0)
|
||||||
|
for (ibase = 0; ibase < TYPE_N_BASECLASSES (t); ibase++)
|
||||||
|
i1 += find_methods (TYPE_BASECLASS (t, ibase), name, sym_arr + i1);
|
||||||
|
|
||||||
|
return i1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add the symbols associated to methods of the class whose type is T
|
||||||
|
and whose name matches the method indexed by METHOD_COUNTER in the
|
||||||
|
array SYM_ARR. Return the number of methods added. */
|
||||||
|
|
||||||
|
static int
|
||||||
|
add_matching_methods (int method_counter, struct type *t,
|
||||||
|
struct symbol **sym_arr)
|
||||||
|
{
|
||||||
|
int field_counter;
|
||||||
|
int i1 = 0;
|
||||||
|
|
||||||
for (field_counter = TYPE_FN_FIELDLIST_LENGTH (t, method_counter) - 1;
|
for (field_counter = TYPE_FN_FIELDLIST_LENGTH (t, method_counter) - 1;
|
||||||
field_counter >= 0;
|
field_counter >= 0;
|
||||||
--field_counter)
|
--field_counter)
|
||||||
|
@ -272,10 +316,21 @@ find_methods (struct type *t, char *name, struct symbol **sym_arr)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strncmp (class_name, name, name_len) == 0
|
|
||||||
&& (class_name[name_len] == '\0'
|
return i1;
|
||||||
|| class_name[name_len] == '<'))
|
}
|
||||||
{
|
|
||||||
|
/* Add the symbols associated to constructors of the class whose type
|
||||||
|
is CLASS_TYPE and which are indexed by by METHOD_COUNTER to the
|
||||||
|
array SYM_ARR. Return the number of methods added. */
|
||||||
|
|
||||||
|
static int
|
||||||
|
add_constructors (int method_counter, struct type *t,
|
||||||
|
struct symbol **sym_arr)
|
||||||
|
{
|
||||||
|
int field_counter;
|
||||||
|
int i1 = 0;
|
||||||
|
|
||||||
/* For GCC 3.x and stabs, constructors and destructors
|
/* For GCC 3.x and stabs, constructors and destructors
|
||||||
have names like __base_ctor and __complete_dtor.
|
have names like __base_ctor and __complete_dtor.
|
||||||
Check the physname for now if we're looking for a
|
Check the physname for now if we're looking for a
|
||||||
|
@ -307,24 +362,6 @@ find_methods (struct type *t, char *name, struct symbol **sym_arr)
|
||||||
if (sym_arr[i1])
|
if (sym_arr[i1])
|
||||||
i1++;
|
i1++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Only search baseclasses if there is no match yet, since names in
|
|
||||||
derived classes override those in baseclasses.
|
|
||||||
|
|
||||||
FIXME: The above is not true; it is only true of member functions
|
|
||||||
if they have the same number of arguments (??? - section 13.1 of the
|
|
||||||
ARM says the function members are not in the same scope but doesn't
|
|
||||||
really spell out the rules in a way I understand. In any case, if
|
|
||||||
the number of arguments differ this is a case in which we can overload
|
|
||||||
rather than hiding without any problem, and gcc 2.4.5 does overload
|
|
||||||
rather than hiding in this case). */
|
|
||||||
|
|
||||||
if (i1 == 0)
|
|
||||||
for (ibase = 0; ibase < TYPE_N_BASECLASSES (t); ibase++)
|
|
||||||
i1 += find_methods (TYPE_BASECLASS (t, ibase), name, sym_arr + i1);
|
|
||||||
|
|
||||||
return i1;
|
return i1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue