[CLASSES]: Move function__has_parameter_of_type from pfunct to libclasses

Will be used by a new tool, ctracer.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2006-12-20 12:03:12 -02:00
parent 770dbc59ee
commit 5484abff49
3 changed files with 22 additions and 19 deletions

View File

@ -664,6 +664,25 @@ static struct function *function__new(uint64_t id, uint64_t type,
return self;
}
int function__has_parameter_of_type(const struct function *self,
const struct class *target)
{
struct class_member *pos;
list_for_each_entry(pos, &self->parameters, tag.node) {
struct class *class = cu__find_class_by_id(self->cu,
pos->tag.type);
if (class != NULL && class->tag.tag == DW_TAG_pointer_type) {
class = cu__find_class_by_id(self->cu, class->tag.type);
if (class != NULL &&
class->tag.id == target->tag.id)
return 1;
}
}
return 0;
}
static void function__add_parameter(struct function *self,
struct parameter *parameter)
{

View File

@ -200,6 +200,9 @@ static inline int function__inlined(const struct function *self)
self->inlined == DW_INL_declared_inlined);
}
extern int function__has_parameter_of_type(const struct function *self,
const struct class *target);
extern const char *class__name(const struct class *self, char *bf, size_t len);
extern struct class_member *class__find_member_by_name(const struct class *self,

View File

@ -217,25 +217,6 @@ static int cu_unique_iterator(struct cu *cu, void *cookie)
function__filter);
}
static int function__has_parameter_of_type(const struct function *self,
const struct class *target)
{
struct class_member *pos;
list_for_each_entry(pos, &self->parameters, tag.node) {
struct class *class = cu__find_class_by_id(self->cu,
pos->tag.type);
if (class != NULL && class->tag.tag == DW_TAG_pointer_type) {
class = cu__find_class_by_id(self->cu, class->tag.type);
if (class != NULL &&
class->tag.id == target->tag.id)
return 1;
}
}
return 0;
}
static int class_iterator(struct function *function, void *cookie)
{
if (function->inlined)