(Changes from Daniel Berlin, with revisions by Jim Blandy.)

Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table.  This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h".  These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted.  These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
This commit is contained in:
Jim Blandy 2001-04-27 00:19:09 +00:00
parent 20b8570d73
commit 015a42b4cf
19 changed files with 972 additions and 478 deletions

View file

@ -35,6 +35,7 @@
#include "complaints.h"
#include "gdbcmd.h"
#include "wrapper.h"
#include "cp-abi.h"
/* These variables point to the objects
representing the predefined C data types. */
@ -1027,7 +1028,7 @@ get_destructor_fn_field (struct type *t, int *method_indexp, int *field_indexp)
for (j = 0; j < TYPE_FN_FIELDLIST_LENGTH (t, i); j++)
{
if (DESTRUCTOR_PREFIX_P (TYPE_FN_FIELD_PHYSNAME (f, j)))
if (is_destructor_name (TYPE_FN_FIELD_PHYSNAME (f, j)) != 0)
{
*method_indexp = i;
*field_indexp = j;
@ -1902,12 +1903,12 @@ virtual_base_index (struct type *base, struct type *dclass)
return -1;
i = 0;
vbase = TYPE_VIRTUAL_BASE_LIST (dclass)[0];
vbase = virtual_base_list (dclass)[0];
while (vbase)
{
if (vbase == base)
break;
vbase = TYPE_VIRTUAL_BASE_LIST (dclass)[++i];
vbase = virtual_base_list (dclass)[++i];
}
return vbase ? i : -1;
@ -1936,14 +1937,14 @@ virtual_base_index_skip_primaries (struct type *base, struct type *dclass)
j = -1;
i = 0;
vbase = TYPE_VIRTUAL_BASE_LIST (dclass)[0];
vbase = virtual_base_list (dclass)[0];
while (vbase)
{
if (!primary || (virtual_base_index_skip_primaries (vbase, primary) < 0))
j++;
if (vbase == base)
break;
vbase = TYPE_VIRTUAL_BASE_LIST (dclass)[++i];
vbase = virtual_base_list (dclass)[++i];
}
return vbase ? j : -1;