Convert static_kind into loc_kind enum.

* gdbtypes.h (enum field_loc_kind): New.
	(union field_location): New field dwarf_block.
	(struct field): Rename static_kind as loc_kind.
	(FIELD_STATIC_KIND): Rename to ...
	(FIELD_LOC_KIND): ... here.
	(TYPE_FIELD_STATIC_KIND): Rename to ...
	(TYPE_FIELD_LOC_KIND): ... here and use there now new FIELD_LOC_KIND.
	(TYPE_FIELD_STATIC_HAS_ADDR): Remove.
	(TYPE_FIELD_STATIC): Remove.
	(TYPE_FIELD_BITPOS): Reformat.
	(SET_FIELD_BITPOS): New.
	(FIELD_PHYSADDR): Rename to ...
	(FIELD_STATIC_PHYSADDR): ... here.
	(TYPE_FIELD_STATIC_PHYSADDR): Follow the FIELD_PHYSADDR rename.
	(SET_FIELD_PHYSADDR): Use new FIELD_LOC_KIND.
	(FIELD_PHYSNAME): Rename to ...
	(FIELD_STATIC_PHYSNAME): ... here.
	(TYPE_FIELD_STATIC_PHYSNAME): Follow the FIELD_PHYSNAME rename.
	(SET_FIELD_PHYSNAME): Use new FIELD_LOC_KIND.
	(FIELD_DWARF_BLOCK, TYPE_FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK): New.
	(field_is_static): New declaration.
	* gdbtypes.c (field_is_static): New function.
	(copy_type_recursive): Update throughout.
	* amd64-tdep.c, c-typeprint.c, coffread.c, cp-valprint.c, dwarf2read.c,
	eval.c, jv-typeprint.c, jv-valprint.c, mdebugread.c, p-typeprint.c,
	p-valprint.c, valops.c, value.c, varobj.c: Update throughout.
This commit is contained in:
Jan Kratochvil
2008-10-08 12:49:13 +00:00
parent aea274d3a7
commit d6a843b594
17 changed files with 150 additions and 86 deletions

View File

@ -2434,6 +2434,20 @@ print_arg_types (struct field *args, int nargs, int spaces)
}
}
int
field_is_static (struct field *f)
{
/* "static" fields are the fields whose location is not relative
to the address of the enclosing struct. It would be nice to
have a dedicated flag that would be set for static fields when
the type is being created. But in practice, checking the field
loc_kind should give us an accurate answer (at least as long as
we assume that DWARF block locations are not going to be used
for static fields). FIXME? */
return (FIELD_LOC_KIND (*f) == FIELD_LOC_KIND_PHYSNAME
|| FIELD_LOC_KIND (*f) == FIELD_LOC_KIND_PHYSADDR);
}
static void
dump_fn_fieldlists (struct type *type, int spaces)
{
@ -2975,18 +2989,25 @@ copy_type_recursive (struct objfile *objfile,
if (TYPE_FIELD_NAME (type, i))
TYPE_FIELD_NAME (new_type, i) =
xstrdup (TYPE_FIELD_NAME (type, i));
if (TYPE_FIELD_STATIC_HAS_ADDR (type, i))
SET_FIELD_PHYSADDR (TYPE_FIELD (new_type, i),
TYPE_FIELD_STATIC_PHYSADDR (type, i));
else if (TYPE_FIELD_STATIC (type, i))
SET_FIELD_PHYSNAME (TYPE_FIELD (new_type, i),
xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type,
i)));
else
switch (TYPE_FIELD_LOC_KIND (type, i))
{
TYPE_FIELD_BITPOS (new_type, i) =
TYPE_FIELD_BITPOS (type, i);
TYPE_FIELD_STATIC_KIND (new_type, i) = 0;
case FIELD_LOC_KIND_BITPOS:
SET_FIELD_BITPOS (TYPE_FIELD (new_type, i),
TYPE_FIELD_BITPOS (type, i));
break;
case FIELD_LOC_KIND_PHYSADDR:
SET_FIELD_PHYSADDR (TYPE_FIELD (new_type, i),
TYPE_FIELD_STATIC_PHYSADDR (type, i));
break;
case FIELD_LOC_KIND_PHYSNAME:
SET_FIELD_PHYSNAME (TYPE_FIELD (new_type, i),
xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type,
i)));
break;
default:
internal_error (__FILE__, __LINE__,
_("Unexpected type field location kind: %d"),
TYPE_FIELD_LOC_KIND (type, i));
}
}
}