Copying Decl instances

Hi! Is here any legal way to clone Decl instance?

Thanks!
Stepan Dyatkovskiy

Hi! Is here any legal way to clone Decl instance?

As far as I know, not really. The issue here is that the cloned Decl node will not
be present in the AST. Inserting it is not trivial since the invariants of the AST
have to be preserved.

Also note that some declaration/statement nodes have trailing objects, and therefore
some kind of "clone" function would have to be provided. For some reason the copy/move
ctors/operators of Decl and Stmt are not deleted, but trying to just copy them is
going to fail badly. (fixed in D60123 for Stmt).

Bruno

Bruno, thanks!

I found that only way to clone decl is to follow ASTParser and ASTReader workflow. And this is definitely non-trivial task to do. Here is some draft snipped, but I found way not to do it though...

https://pastebin.com/MG50vQiD

Stepan Dyatkovskiy