[LLVMdev] Changing the return type for a function after construction

Chris Lattner sabre at nondot.org
Sat Mar 8 12:30:57 PST 2008


On Mar 8, 2008, at 7:48 AM, Robert Zeh wrote:

> Is there any way to change the return type of a function after
> constructing one?

Nope. Once created, you can't change the type of a Value.  The best  
way to do this is to create a new function, splice the body of the old  
over (a constant time operation) and update the new one.  Take a look  
at the dead argument elimination pass for some example code.

-Chris



More information about the llvm-dev mailing list