Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » CDT API for macro introspections
CDT API for macro introspections [message #1008405] Tue, 12 February 2013 11:01
Michaël Melchiore is currently offline Michaël MelchioreFriend
Messages: 47
Registered: April 2012
Member
Hello all,

I am implementing an automatic data types importer from C source files to a custom EMF (IDL like) metamodel. I chose CDT for my first prototype as it provides convenient introspection abilities and would allow me to remain in the Eclipse/Java ecosystem.

As references, I use "Using CDT APIs to programmatically introspect C/C++ code" from Markus Schorn, a CDT dev FAQ and the project generated javadoc.

I have written a small C project on which I can test my features as I implement them. Using C-Model and C-Index cooperatively, I can successfully query a CDT project for its defined type aliases, arrays, structs and unions. Yet, I am having trouble dealing with macros.

I found no simple way to compute which types relied on macros (ex: array sizes, ...) in their definitions: macro values are already expanded in typedef bindings and AST. The C-Index does provide methods to quickly find out all references of a given macro, but I have been unable to link a reference with its enclosing definition: the "getEnclosingDefinition" method is unimplemented for macros.

Is it difficult to implement it ? Should I try to compare file locations instead ? It seems tedious and with scaling issues.

Regards,

Michaël

Previous Topic:CDT Code analysis gives errors for custom compilers
Next Topic:CodeSourcery gcc Lite, ADuCM360 and Eclipse
Goto Forum:
  


Current Time: Fri Apr 26 10:34:33 GMT 2024

Powered by FUDForum. Page generated in 0.03948 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top