This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to find function_decl by identifier in plugin


Hello!

I am writing some plugin and I have a problem with creating a function call.
For creating call (by gimple_build_call) I have to specify the
function_decl tree.
How can I get the list of all declarations (that used not only in
current function, I need get the all available declarations also from
included headers) in order to lookup by identifier function_decl which
I want to call?

For example:
/* lookup_fn_decl - It is some pseudo-function which searches a
function declaration by identifier */
/* all_decl_list_head - It is pointer to the head list of all
declarations. It is what I need */
tree found_decl = lookup_fn_decl(all_decl_list_head, "pthread_create");
if (found_decl == NULL) {
  /* We need to create decl */
} else {
  ....
}

-Ivan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]