I have an object of type CallInst
. How can I get the called function name from it. Assume the function is called directly.
我有一个CallInst类型的对象。如何从中获取被调用的函数名称。假设直接调用该函数。
1 个解决方案
#1
17
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:
无论如何,这就是文档所暗示的:
#1
17
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:
无论如何,这就是文档所暗示的: