Hi Krishna
Yes, you have two options:
1. You can create a TextFileChange with an InsertEdit. That is not CDT specific though. These classes are part of the LTK. Depending on how you
already create the changes to your code, you can add that TextFileChange to the already created modifications.
2. You can insert an ASTLiteralNode. This node will never appear in the AST, but you can use it to insert code without specific representation
to the AST.
The first approach is more flexible, while the latter is easier to use. You might need to use the first one, as I'm not sure whether the ASTLiteralNode
approach is enough powerful regarding its location. I.e. I think you cannot insert an include directive between other include directives with the ASTLiteralNode, as the other include directives are not represented in the AST either.
Kind Regards
Thomas
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Krishna Narasimhan
Sent: Mittwoch, 25. Juni 2014 13:57
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] Adding "Include" and other Preprocessor statements to the AST
Hello guys,
I am Krishna and developing some unconventional ast transformations that involve migrating between APIs. For this , I need to be able to include preprocessor directives into the code.
Is this possible using CDT? If not, what are the alternatives.