Hi,
The macro expansion itself is recorded, you can find it via IASTTranslationUnit.getMacroExpansions() .
You are right, the methods you are named getSyntax(), getLeadingSyntax() and getTrailingSyntax().
Markus.
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Sanjesh R Nair
Sent: Wednesday, July 06, 2011 11:16
To: CDT General developers list.
Subject: Re: [cdt-dev] Parsing macros in the declaration
Importance: Low
Thanks Markus,
So, as I see, the only way to get this macro or the macro expansion is to loop through the tokens part of the syntax.
Also, the method that I found with the ASTNode was ASTNode.getLeadingSyntax() and getSyntax() and not getLeadingTokens(). Is this the correct set of methods or am I missing something?
Thanks,
Sanjesh.
From:
|
"Schorn, Markus" <Markus.Schorn@xxxxxxxxxxxxx>
|
To:
|
"CDT General developers list." <cdt-dev@xxxxxxxxxxx>
|
Date:
|
07/06/2011 01:14 PM
|
Subject:
|
Re: [cdt-dev] Parsing macros in the declaration
|
Sent by:
|
cdt-dev-bounces@xxxxxxxxxxx
|
Hi Sanjesh,
The CDT parser preprocesses the source code (which includes expanding macros) and creates an AST for the result. However, the AST does not have a representation for ‘__declspec(dllimport)’,
this particular information is dropped.
As a workaround you can look at the tokens before the name ‘X’, using ASTNode.getLeadingTokens() on the ASTNode representing the name ‘X’.
Markus.
From:
cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Sanjesh R Nair
Sent: Thursday, June 30, 2011 11:33
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] Parsing macros in the declaration
Importance: Low
Hi All,
Does CDT parse and load the following declaration in the AST model?
#define IMPORT __declspec(dllimport)
class IMPORT X {};
Would I get the __declspec(dllimport) or the macro as part of the AST?
Thanks,
Sanjesh._______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev