Change Name of LLVM Function

2019-03-03 04:24发布

问题:

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.



标签: c++ clang llvm