Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Getting type information from AST
Getting type information from AST [message #1765086] Tue, 06 June 2017 13:05 Go to next message
Marcus Tangermann is currently offline Marcus TangermannFriend
Messages: 4
Registered: June 2017
Junior Member
Hi,

I'm working on a plugin for C code generation which is based on the CDT.
I'm trying to retrieve type information for return values and parameters for functions.
Therefore I get IFunction instances from the AST and use the type information for the IParameter instances and the return type of the function itself.

The problem I currently have usign this method is, that I cannot get the original string of a type but only the string that is returned by getName of ICompositeType or ITypedef.
If the type was defined using a #define directive (e.g. #define TYPE_CHAR_P char* ), that name is no retrievable. getType returns a type that already resolves to char* but I would need TYPE_CHAR.

Is there a way to get the original string?

Regards
Marcus

Re: Getting type information from AST [message #1765117 is a reply to message #1765086] Tue, 06 June 2017 19:57 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Hi Marcus, I don't know the answer to your question. The CDT does support browsing the macro expansions, so I would suggest starting by looking at how that code works and see if you can apply it to your case.

HTH for a start.
Re: Getting type information from AST [message #1765281 is a reply to message #1765117] Thu, 08 June 2017 06:15 Go to previous message
Marcus Tangermann is currently offline Marcus TangermannFriend
Messages: 4
Registered: June 2017
Junior Member
Hi Jonah,

thanks for the advice.
I will start to take a look at the AST Visitor. This should be usable to retrieve the missing information.

Regards
Marcus
Previous Topic:(symbol) could not be resolved
Next Topic:Eclipse - pointer to function parameters hints
Goto Forum:
  


Current Time: Thu Apr 25 20:52:49 GMT 2024

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

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

Back to the top