[LLVMdev] Utility function to identify user defined function

Óscar Fuentes ofv at wanadoo.es
Tue Jan 22 09:19:34 PST 2013


"Hassan, Ahmad" <ahmad.hassan at 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.




More information about the llvm-dev mailing list