[cfe-dev] How can I mutate some information in the AST, given a Decl* ?

Nikola Smiljanic popizdeh at gmail.com
Thu Jul 10 20:23:10 PDT 2014


Have a look at lib/Sema/TreeTransform.h, it should allow you to transform
your existing AST into new one.


On Fri, Jul 11, 2014 at 1:13 PM, Nikola Smiljanic <popizdeh at gmail.com>
wrote:

> I'm afraid that you can't because AST is supposed to be immutable once
> built. You might be able to achieve this through source to source
> translation...
>
>
> On Fri, Jul 11, 2014 at 11:46 AM, Manasij Mukherjee <manasij7479 at gmail.com
> > wrote:
>
>>  Hi,
>> I have a Decl* which can be cast into the appropriate Decl types.
>> I want to remove some specific information about that Decl from the AST.
>>
>> For example, if it isa ClassTemplateDecl, I need to remove its default
>> template arguments if it has them.
>>
>> Or if I have an EnumDecl that has a specific type specified, like:
>> (enum a :int {a,b,c};)
>> That information needs to be erased.
>>
>> How can I perform these kinds of changes to a Decl?
>>
>> Manasij Mukherjee
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140711/2a98043e/attachment.html>


More information about the cfe-dev mailing list