[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-core-dev] Questions of manipulating AST
|
Hello,
I'm a newbie to cdt though I have written some tiny plug ins with jdt.
I am doing a small plug-in project with cdt because I have to deal with
C/C++ code this time. The first step is as follows:
1. I need to put certain profiling code before and after selected
language constructs such as function calls, loops and function bodies.
2. I will put special comment lines like "// !@#$%^ begins" "// !@#$%^
ends" before and after the added profiling code.I will be able to
remove the profiling code based on these special comments automatically.
3. I will declare some new variables and add #include to the original code for profiling use.
With jdt, I can use org.eclipse.jdt.core.dom.rewrite.ASTRewrite to
change the AST tree. But I have no idea how to do this with cdt. My
questions are:
1. What is the best way to do tree changes in cdt and where are the
documentation and examples? I tried to look at the refactorying
code but couldn't understand it quickly.
2. Anything special about manipulating comments? I believe they are treated differently.
Thanks a lot for your help!
Best,
Qingda Lu