Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to use CDT lib/java source

Hi Ming,

One way would be to use the AST writing capabilities of CDT. This allows you to create nodes, insert them, etc then generate the code from this new AST. There are several places in the CDT codebase that use that, namely the refactorings which are mostly in org.eclipse.cdt.internal.ui.refactoring.* packages, see
There are also smaller spots in “quick fix” in package org.eclipse.cdt.codan.internal.checkers.ui.quickfix, see

I found this presentation about CDT refactoring, there are a few slides about creating AST nodes (node factory), ASTRewrite and generating changes that might useful to you:

About how to use this within your tool, it will depend a lot on how close your tool is to being an Eclipse plugin running in a workspace with a C/C++ project. If some of those conditions are not met, you will have a few more hurdles, like having to add all cdt.core dependencies on the classpath, figuring out if you can do AST writing on an external file (non-workspace), etc.

Either way, it sounds like an interesting project and something that you could write about in a blog or developer FAQ if you do manage to get it working.


On Oct 23, 2019, at 1:58 AM, Ming Cheng <chengm349@xxxxxxxxxxx> wrote:

Hi The team,
I want to develop C++ source code generator according to user’s diagram something like UML tool but very limited just for my needs. So my questions are:
  1. Can I call CDT lib’s API to generate C++ class/functions?
  2. What’s the ABC steps so I can follow them to merge the lib into my tool to see some very basic features?
Ming Cheng.
Warm Regards
Sent from Mail for Windows 10
cdt-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top