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

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

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>

> 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/8690ce5f/attachment.html>

More information about the cfe-dev mailing list