[cfe-dev] Cloning a FunctionDecl
Manjunath Kudlur
keveman at gmail.com
Tue Feb 28 19:47:20 PST 2012
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,
void foo() {}
I want to add the FunctionDecls for
void foo(type1) {} and void foo(type2) {}
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.
Manjunath
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120228/a94f708f/attachment.html>
More information about the cfe-dev
mailing list