|[cdt-dev] Need suggestions for analyzing and transforming C++ code|
I have been using the AST for analyzing C++ code and now I would like to write a transformation program.
So the big question I have is “What techniques can I use?”
One way would be to crank up a visitor to visit all of the nodes in the compilation unit. As you descend the tree, you process the nodes and then output them to a .h/.cpp file.
I was wondering if there are other examples of transformations. The refactoring functionality has to perform transformations. So how do I find the action that handles the refactoring functions, say “rename”, so I can peruse the code?
The goal of the transformation is to take a .h/.cpp file as input, and re-factor each class into two separate classes: one that would contain modeled data and function members while the other would contain non-modeled artifacts.
Any help would be appreciated.
Back to the top