Reputation: 407
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?
Upvotes: 3
Views: 2200
Reputation: 37177
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.
Upvotes: 6