Identifying user define function through llvm pass

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Identifying user define function through llvm pass

Abhinash Jain
This post was updated on .
Is there anyway by which I can identify whether the callee function is a user define or not?
For example:
void foo()
{
   printf("hello world again");
}
int main()
{
   printf("hello world\n");
   foo();
}

As in this case foo() is a user define, whereas printf() is a library function.

EDIT:
The method I'm currently using is to iterate over all the modules and check if its size is greater than 0 or not.
i.e:
                        for(Module::iterator F = M.begin(); F != M.end(); ++F)
                        {
                                Function &Func = *F;
                                if(F->size()>0)
                                        errs() << "User Define";
                        }

But am not sure about its accuracy?