[cfe-dev] Copying Decl instances

Bruno Ricci via cfe-dev cfe-dev at lists.llvm.org
Fri Apr 12 05:47:52 PDT 2019



On 12/04/2019 13:07, via cfe-dev wrote:
> 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

>  
> Thanks!
> Stepan Dyatkovskiy
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> 


More information about the cfe-dev mailing list