<div>Hello,</div><div> </div><div>Is there a way to clone a FunctionDecl, including the body Stmt if it exists? I want to add an entirely new decl to the AST with its own copy of the body. I would like to start with a completely identical Decl and body, and then modify it to produce a new overload, such that this cloned function would appear in overload resolution for calls to the original function. </div>
<div> </div><div>What I want to do is somewhat similar to template instantiation, but I've been looking through this mechanism and it *appears* that function templates don't actually duplicate the body of the function until LLVM code gen, is that true? I need a proper clone of the function so that mechanism is not useful as a starting point if that is the case.</div>
<div> </div><div>What is the most effective way to accomplish this? </div><div> </div><div>Thanks</div><div>Dillon</div>