dwarves: Introduce tag__is_typedef()

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2008-09-30 14:21:03 -03:00
parent 7dfd45ffea
commit 0614c1d53e
3 changed files with 10 additions and 5 deletions

View File

@ -156,7 +156,7 @@ struct tag *tag__follow_typedef(struct tag *tag, const struct cu *cu)
{
struct tag *type = cu__find_tag_by_id(cu, tag->type);
if (type != NULL && type->tag == DW_TAG_typedef)
if (type != NULL && tag__is_typedef(type))
return tag__follow_typedef(type, cu);
return type;
@ -578,7 +578,7 @@ struct tag *cu__find_first_typedef_of_type(const struct cu *self,
return NULL;
list_for_each_entry(pos, &self->tags, node)
if (pos->tag == DW_TAG_typedef && pos->type == type)
if (tag__is_typedef(pos) && pos->type == type)
return pos;
return NULL;
@ -1129,7 +1129,7 @@ static size_t type__fprintf(struct tag *type, const struct cu *cu,
if (expand_types) {
int typedef_expanded = 0;
while (type->tag == DW_TAG_typedef) {
while (tag__is_typedef(type)) {
ctype = tag__type(type);
if (typedef_expanded)
printed += fprintf(fp, " -> %s",

View File

@ -83,6 +83,11 @@ static inline int tag__is_struct(const struct tag *self)
self->tag == DW_TAG_class_type;
}
static inline int tag__is_typedef(const struct tag *self)
{
return self->tag == DW_TAG_typedef;
}
static inline int tag__is_union(const struct tag *self)
{
return self->tag == DW_TAG_union_type;

View File

@ -453,7 +453,7 @@ static void class__resize_LP(struct tag *tag, struct cu *cu)
tag__assert_search_result(type);
}
if (type->tag == DW_TAG_typedef) {
if (tag__is_typedef(type)) {
type = tag__follow_typedef(type, cu);
tag__assert_search_result(type);
}
@ -525,7 +525,7 @@ static void union__find_new_size(struct tag *tag, struct cu *cu)
type = cu__find_tag_by_id(cu, tag_pos->type);
tag__assert_search_result(type);
if (type->tag == DW_TAG_typedef)
if (tag__is_typedef(type))
type = tag__follow_typedef(type, cu);
if (type->tag == DW_TAG_union_type)