[cfe-dev] How can I mutate some information in the AST, given a Decl* ?
Manasij Mukherjee
manasij7479 at gmail.com
Thu Jul 10 23:49:23 PDT 2014
I am trying to (automatically) generate forward declarations which can be
included before the original header.
But there are a few conflicts,
Say..template default arguments can only appear once.
Now, the forward declarations must have the default arguments as other
things(like functions) may use the type in its argument or return type
without specifying all the parameters.
So, I am trying to change the old information when including my original
file which has the full definition.
I would prefer not to change the original file as it may be a system header.
On Fri, Jul 11, 2014 at 11:45 AM, Nikola Smiljanic <popizdeh at gmail.com>
wrote:
> Can you tell us what are you trying to do exactly? I'm confused because
> you asked about modifying ast and now you're talking about 'new' source and
> I don't quite get it.
>
> I know very little about this but I know that you can't mutate the
> original AST. TreeTransfrom should allow you to generate a new modified AST
> while preserving invariants. The way I understand this simply removing all
> default template parameters would break the AST in all the places where
> you're instantiating the template with default arguments.
>
>
> On Fri, Jul 11, 2014 at 3:34 PM, Manasij Mukherjee <manasij7479 at gmail.com>
> wrote:
>
>> Well, I already have a 'new' source.
>> So, the same could be achieved by making clang forget about the old
>> declaration.
>> Can I do that?
>>
>> If clang already knows about:
>> template<typename T=int> class Foo;
>>
>> and I have a new source that is about to get parsed:
>>
>> template<typename T=int> class Foo {
>> //implementation
>> }
>>
>> Will it be possible to just 'erase' the old one?
>>
>> Manasij Mukherjee
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140711/6bc745e2/attachment.html>
More information about the cfe-dev
mailing list