更改LLVM功能的名称 [英] Change Name of LLVM Function
问题描述
我有一个LLVM模块对象,其中包含一个特定的函数,我想重命名。是否有任何简单更改函数名称的方法?
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?
推荐答案
给定一个模块,名称,使用 getFunction
方法,或你可以使用 begin()
和 end()
遍历模块中的所有函数。从那里, Function
继承自 Value
,所以你可以使用 setName
方法更改名称。这也将自动更新在同一模块内的所有引用和调用。
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.
这篇关于更改LLVM功能的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!