agg212
agg212

Reputation: 407

Change Name of LLVM Function

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

Answers (1)

Ismail Badawi
Ismail Badawi

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

Related Questions