[cfe-dev] Question about using Clang for source to source transformation.

김신형 mywayin2sky at gmail.com
Tue Sep 14 08:00:11 PDT 2010


 Hello,
I want to insert new functions into original source code.
So, I tried to do as below.

Since I have a ASTContext object,
I make a QualType object using ASTContext.getFunctionType() and
also make a IdentifierInfo object.
And then finally make a FunctionDecl Object using FunctionDecl::Create().

There are no compiler-time or run-time errors.
But I fail to make a new function object.

Similary, I can replace original statments with new statements.
But It's difficult to create a new statement indepedently.
How can I make a new expr, stmt, or function without using existing one?
If you have any sample code, please let me know.

Any suggestion will be very helpful to me.
Thank you.

- K




More information about the cfe-dev mailing list