[LIB]: Rename cus__emit_struct_definitions to cus__emit_type_definitions

To make it handle unions too.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2007-01-13 14:19:34 -02:00
parent 03530985c1
commit 3a9ceb41ee
3 changed files with 16 additions and 15 deletions

View File

@ -178,7 +178,7 @@ static void emit_struct_defs(const char *name)
struct cu *cu;
struct tag *c = cus__find_struct_by_name(kprobes_cus, &cu, name);
if (c != NULL)
cus__emit_struct_definitions(kprobes_cus, cu, c, NULL, NULL);
cus__emit_type_definitions(kprobes_cus, cu, c, NULL, NULL);
}
static void emit_class_fwd_decl(const char *name)

View File

@ -2578,12 +2578,13 @@ static int cus__emit_typedef_definitions(struct cus *self, struct cu *cu,
case DW_TAG_subroutine_type:
cus__emit_ftype_definitions(self, cu, tag__ftype(type));
break;
case DW_TAG_structure_type: {
case DW_TAG_structure_type:
case DW_TAG_union_type: {
const struct type *ctype = tag__type(type);
if (ctype->name == NULL) {
cus__emit_struct_definitions(self, cu, type,
"typedef", def->name);
cus__emit_type_definitions(self, cu, type,
"typedef", def->name);
goto out;
}
}
@ -2671,9 +2672,10 @@ next_indirection:
return cus__emit_enumeration_definitions(self, type);
break;
case DW_TAG_structure_type:
case DW_TAG_union_type:
if (pointer)
return cus__emit_fwd_decl(self, tag__type(type));
return cus__emit_struct_definitions(self, cu, type, NULL, NULL);
return cus__emit_type_definitions(self, cu, type, NULL, NULL);
case DW_TAG_subroutine_type:
return cus__emit_ftype_definitions(self, cu, tag__ftype(type));
}
@ -2698,11 +2700,10 @@ int cus__emit_ftype_definitions(struct cus *self, struct cu *cu,
return printed;
}
int cus__emit_struct_definitions(struct cus *self, struct cu *cu,
struct tag *tag,
const char *prefix, const char *suffix)
int cus__emit_type_definitions(struct cus *self, struct cu *cu,
struct tag *tag,
const char *prefix, const char *suffix)
{
struct class *class;
struct type *ctype = tag__type(tag);
struct class_member *pos;
int printed = 0;
@ -2718,15 +2719,15 @@ int cus__emit_struct_definitions(struct cus *self, struct cu *cu,
cus__add_definition(self, ctype);
class = tag__class(tag);
list_for_each_entry(pos, &class->type.members, tag.node)
list_for_each_entry(pos, &ctype->members, tag.node)
if (cus__emit_tag_definitions(self, cu, &pos->tag))
printed = 1;
if (printed)
putchar('\n');
class__find_holes(class, cu);
if (tag->tag == DW_TAG_structure_type)
class__find_holes(tag__class(tag), cu);
tag__print(tag, cu, prefix, suffix);
putchar('\n');
return 1;

View File

@ -259,9 +259,9 @@ extern struct tag *cus__find_function_by_name(const struct cus *self,
const char *name);
extern int cus__emit_ftype_definitions(struct cus *self, struct cu *cu,
struct ftype *ftype);
extern int cus__emit_struct_definitions(struct cus *self, struct cu *cu,
struct tag *tag, const char *prefix,
const char *suffix);
extern int cus__emit_type_definitions(struct cus *self, struct cu *cu,
struct tag *tag, const char *prefix,
const char *suffix);
extern int cus__emit_fwd_decl(struct cus *self, struct type *ctype);
extern struct tag *cu__find_tag_by_id(const struct cu *self,