Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Accessing CDT's AST using a new Plugin

Hello,

this is my first mail on the list, I hope it's the right place for these
kind of questions, if not I hope you can point me to the right one :)

Me and some friends started with planning an Eclipse plugin that is
supposed to create and show a dependency graph for C++ projects much
like Metrics (http://metrics.sourceforge.net/) already does it for Java
projects.
To achieve this goal we're planning to use CDT and it's Abstract Syntax
Tree.
We don't want to create a fork of your plugin but create a new one that
extends the features of CDT.
The result will be FOSS of course!

The first thing we need to know now is whether it's technically possible
to create such a plugin.
To assure this I tried to find an example that accesses CDT's AST in a
way we can do it too but the only thing I found is this:
http://www-128.ibm.com/developerworks/opensource/library/os-ecl-cdt3/
It looked much like we could reuse this example except the fact that in
this article a "Bare Bone" version of CDT is created and not an Eclipse
plugin.
Nonetheless I tried to compile the code example at the bottom but the
method "getCompilationUnit()" didn't work.
I tried to get a "CompilationUnit" directly from a source file but
didn't find documentation how to do this.

I'm guessing I need to create an Eclipse plugin that extends CDT first
(Fragment project right?) so  "getCompilationUnit()" can access the (?
currently open ?) CPP-file, but I've never created an Eclipse plugin so
this isn't to easy for me.

Now my questions are:
- How can I best access CDT's AST using an Eclipse plugin (would the IBM
example above work at all)?
- And how does this plugin need to look like (how do I start extending CDT)?
Of course I'm not asking you for a complete source code (except you
already know a complete example :) but I need some hints, or a link to
the documentation I didn't find using google, in order to make some
progress.

I'm very grateful for every hint you can give me.

Best regards,

Max

PS: Excuse my poor English.


Back to the top