dwarves: use tag__is_function in the tools

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2009-03-06 11:14:26 -03:00
parent b19ac641ba
commit 9fadbfffba
10 changed files with 19 additions and 24 deletions

View File

@ -72,8 +72,6 @@ static void diff_function(const struct cu *new_cu, struct function *function,
struct tag *new_tag;
const char *name;
assert(function->proto.tag.tag == DW_TAG_subprogram);
if (function->inlined || function->abstract_origin != 0)
return;
@ -285,7 +283,7 @@ static int diff_tag_iterator(struct tag *tag, struct cu *cu, void *new_cu)
{
if (tag__is_struct(tag))
diff_struct(new_cu, tag__class(tag), cu);
else if (tag->tag == DW_TAG_subprogram)
else if (tag__is_function(tag))
diff_function(new_cu, tag__function(tag), cu);
return 0;
@ -298,8 +296,6 @@ static int find_new_functions_iterator(struct tag *tfunction, struct cu *cu,
struct tag *old_function;
const char *name;
assert(function->proto.tag.tag == DW_TAG_subprogram);
if (function->inlined)
return 0;
@ -350,7 +346,7 @@ static int find_new_classes_iterator(struct tag *tag, struct cu *cu, void *old_c
static int find_new_tags_iterator(struct tag *tag, struct cu *cu, void *old_cu)
{
if (tag->tag == DW_TAG_subprogram) {
if (tag__is_function(tag)) {
/*
* We're not interested in aliases, just real function definitions,
* where we'll know if the kind of inlining
@ -609,7 +605,7 @@ static int show_function_diffs_iterator(struct tag *tag, struct cu *cu,
{
struct function *function = tag__function(tag);
if (tag->tag == DW_TAG_subprogram && function->priv != NULL)
if (tag__is_function(tag) && function->priv != NULL)
show_diffs_function(function, cu, cookie);
return 0;
}

View File

@ -172,7 +172,7 @@ static void method__add(struct cu *cu, struct function *function, uint32_t id)
}
/*
* We want just the DW_TAG_subprogram tags that have as one of its parameters
* We want just the function tags that have as one of its parameters
* a pointer to the specified "class" (a struct, unions can be added later).
*/
static struct function *function__filter(struct function *function,
@ -189,7 +189,7 @@ static struct function *function__filter(struct function *function,
/*
* Iterate thru all the tags in the compilation unit, looking just for the
* DW_TAG_subprogram tags that have as one of its parameters a pointer to
* function tags that have as one of its parameters a pointer to
* the specified "class" (struct).
*/
static int cu_find_methods_iterator(struct cu *cu, void *cookie)

View File

@ -960,7 +960,7 @@ static void die__process_class(Dwarf_Die *die, struct type *class,
namespace__add_tag(&class->namespace, tag);
cu__hash(cu, tag);
if (tag->tag == DW_TAG_subprogram) {
if (tag__is_function(tag)) {
struct function *fself = tag__function(tag);
if (fself->vtable_entry != -1)

View File

@ -792,7 +792,7 @@ struct tag *cu__find_function_by_name(const struct cu *self, const char *name)
return NULL;
list_for_each_entry(pos, &self->tags, node) {
if (pos->tag != DW_TAG_subprogram)
if (!tag__is_function(pos))
continue;
fpos = tag__function(pos);
if (fpos->name && strcmp(s(fpos->name), name) == 0)
@ -1668,7 +1668,7 @@ void cu__account_inline_expansions(struct cu *self)
struct function *fpos;
list_for_each_entry(pos, &self->tags, node) {
if (pos->tag != DW_TAG_subprogram)
if (!tag__is_function(pos))
continue;
fpos = tag__function(pos);
lexblock__account_inline_expansions(&fpos->lexblock, self);
@ -2421,8 +2421,7 @@ size_t tag__fprintf(struct tag *self, const struct cu *cu,
++printed;
}
if (self->tag == DW_TAG_subprogram &&
!pconf->suppress_comments) {
if (tag__is_function(self) && !pconf->suppress_comments) {
const struct function *fself = tag__function(self);
if (fself->linkage_name)

View File

@ -676,7 +676,7 @@ static int cu_fixup_word_size_iterator(struct cu *cu, void *cookie)
static struct tag *nr_methods__filter(struct tag *tag, struct cu *cu __unused,
void *cookie __unused)
{
if (tag->tag != DW_TAG_subprogram)
if (!tag__is_function(tag))
return NULL;
if (function__declared_inline(tag__function(tag)))

View File

@ -23,7 +23,7 @@ static void emit_tag(struct tag *self, uint32_t tag_id, struct cu *cu)
if (tag__is_struct(self))
class__find_holes(tag__class(self), cu);
conf.no_semicolon = self->tag == DW_TAG_subprogram;
conf.no_semicolon = tag__is_function(self);
printf("%d ", tag_id);
@ -39,7 +39,7 @@ static void emit_tag(struct tag *self, uint32_t tag_id, struct cu *cu)
else
tag__fprintf(self, cu, &conf, stdout);
if (self->tag == DW_TAG_subprogram) {
if (tag__is_function(self)) {
struct function *fn = tag__function(self);
putchar('\n');
lexblock__fprintf(&fn->lexblock, cu, fn, 0, stdout);

View File

@ -215,7 +215,7 @@ static struct tag *function__filter(struct tag *tag, struct cu *cu,
struct fn_stats *fstats;
const char *name;
if (tag->tag != DW_TAG_subprogram)
if (!tag__is_function(tag))
return NULL;
if (!tag->top_level)
@ -261,7 +261,7 @@ static struct tag *function__filter(struct tag *tag, struct cu *cu,
static int unique_iterator(struct tag *tag, struct cu *cu,
void *cookie __unused)
{
if (tag->tag == DW_TAG_subprogram)
if (tag__is_function(tag))
fn_stats__add(tag, cu);
return 0;
}
@ -277,7 +277,7 @@ static int class_iterator(struct tag *tag, struct cu *cu, void *cookie)
uint16_t *target_id = cookie;
struct function *function;
if (tag->tag != DW_TAG_subprogram)
if (!tag__is_function(tag))
return 0;
function = tag__function(tag);
@ -335,7 +335,7 @@ static int function_iterator(struct tag *tag, struct cu *cu, void *cookie)
{
struct function *function;
if (tag->tag != DW_TAG_subprogram)
if (!tag__is_function(tag))
return 0;
function = tag__function(tag);

View File

@ -139,7 +139,7 @@ static struct tag *extfun__filter(struct tag *tag, struct cu *cu __unused,
{
struct function *fun;
if (tag->tag != DW_TAG_subprogram)
if (!tag__is_function(tag))
return NULL;
fun = tag__function(tag);

View File

@ -120,7 +120,7 @@ static int refcnt_tag_iterator(struct tag *tag, struct cu *cu, void *cookie)
{
if (tag__is_struct(tag))
class__find_holes(tag__class(tag), cu);
else if (tag->tag == DW_TAG_subprogram)
else if (tag__is_function(tag))
refcnt_function_iterator(tag__function(tag), cu, cookie);
return 0;

View File

@ -23,7 +23,7 @@ static size_t prefix_len = 4;
static struct tag *filter(struct tag *self, struct cu *cu,
void *cookie __unused)
{
if (self->tag == DW_TAG_subprogram) {
if (tag__is_function(self)) {
struct function *f = tag__function(self);
if (f->proto.nr_parms != 0) {