I have a LLVM Module object which contains a particular function that I would like to rename. Is there any way of simply changing the name of a Function?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Given a module, you can look up a specific function by name using the getFunction
method, or you can iterate over all the functions in the module using begin()
and end()
. From there, Function
inherits from Value
, so you can just use the setName
method change the name. This will also automatically update all the references and calls to it inside the same module.