[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:
parent
770dbc59ee
commit
5484abff49
19
classes.c
19
classes.c
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
19
pfunct.c
19
pfunct.c
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue