Utility function to identify user defined function

Hi,

I would like to ask if LLVM provides a utility function like ‘isMallocCall’ to check if the ‘call’ instruction is calling some ‘foo’ user defined function?

If there is no such utility function then I am thinking to do this in the following way:

bool testFoo(CallInst *CI) {

Function *Callee = CI->getCalledFunction();

if (Callee->getName() == “foo”)

return true;

return false;

}

Thanks.

Cheers, Ahmad

"Hassan, Ahmad" <ahmad.hassan@sap.com> writes:

I would like to ask if LLVM provides a utility function like
'isMallocCall' to check if the 'call' instruction is calling some
'foo' user defined function?

If there is no such utility function then I am thinking to do this in
the following way:

bool testFoo(CallInst *CI) {
Function *Callee = CI->getCalledFunction();
if (Callee->getName() == "foo")
    return true;
return false;
}

Depending on the exact meaning of "user defined function" you can check
if the function contains any BasicBlock. The method Function::empty() is
handy for that.

I am looking for utility function to check if a particular user defined function i.e. foo1, foo2 is called.

Cheers, Ahmad