Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Getting type information from AST
Getting type information from AST [message #1765086] Tue, 06 June 2017 09:05 Go to next message
Eclipse UserFriend
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 15:57 Go to previous messageGo to next message
Eclipse UserFriend
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 02:15 Go to previous message
Eclipse UserFriend
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: Sat Mar 15 04:53:38 EDT 2025

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

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

Back to the top