How can I get the function name from CallInst in LLVM?

I have an object of type CallInst . How can I get the name of the called function from it. Suppose a function is called directly.

+8
c ++ c clang llvm
source share
1 answer
 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"); } 

In any case, what the documentation implies:

+16
source share

All Articles