<div dir="ltr">I am doing some transformation where I want to add 2 different versions of a function to the clang AST as soon as I am done parsing the function. For example, when I am done parsing foo as below,<div><br></div>
<div>void foo() {}</div><div><br></div><div>I want to add the FunctionDecls for</div><div><br></div><div>void foo(type1) {} and void foo(type2) {}</div><div><br></div><div>to the AST. The method I want to try is, as soon as I get a Decl from ParseFunctionDefinition, I want to clone the FunctionDecl and make 2 copies, change the types of the copies appropriately, create a DeclGroupPtrTy using DeclGroupRef::Create() from the copies, and return it. But I don't know how to make a clone of a FunctionDecl. Is this a reasonable approach for what I am trying to do? If so, how can I clone a FunctionDecl? If not, I would appreciate any hints on how to achieve this.</div>
<div><br></div><div>Manjunath</div></div>