Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] question about ASTRewrite

Hi there,

 

I am trying to assess the Eclipse CDT features in the area of code refactoring and have a naïve question about how to deal with ASTRewrite (sorry if the questions was answered at some point, and I could not find it).

 

In order to do a change in the AST, e.g. to insert an IASTNode (e.g. using ASTRewrite.insertBefore method), I need to create that ASTNode first.

For example, if I am interested in creating a new node of type ICPPASTCompositeTypeSpecifier, how do I create it?

 

There’s an internal non-interface class CPPASTCompositeTypeSpecifier that I can instantiate, but Eclipse is saying it is not recommended to use it. Also, I am not sure if it will allow me to override some of its methods.

 

Another option is to create my custom class and implement ICPPASTCompositeTypeSpecifier interface, however, it seems like it an overkill to implement all the virtual methods of ICPPASTCompositeTypeSpecifier and others interface classes that it extends.

 

So what is the best option you would recommend?

 

Thanks,

Andrey

 


Back to the top