I have an object of type CallInst
. How can I get the name of the called function (aka callee). Assume the function is called directly (i.e., no indirect function calls).
Asked
Active
Viewed 9,927 times
1 Answers
25
StringRef get_function_name(CallInst *call)
{
Function *fun = call->getCalledFunction();
if (fun) // thanks @Anton Korobeynikov
return fun->getName(); // inherited from llvm::Value
else
return StringRef("indirect call");
}
anyway, that's what the documentation implies:

Useless
- 64,155
- 6
- 88
- 132
-
16Note that fun can be NULL here in case of indirect call. – Anton Korobeynikov Jul 27 '12 at 15:02