[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] IASTInitializerList getClauses()

The literals are not represented when you create the AST with one of the options (depending on the API you are using):
ILanguage.OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS,
ITranslationUnit.AST_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS.
Also when using the shared AST provided by the editor, the literals are not represented.
 
The AST Browser does not use the option when creating the AST, so the literals are there.
Markus.


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Andreas Graf
Sent: Thursday, August 26, 2010 3:52 PM
To: CDT DEV (cdt-dev@xxxxxxxxxxx)
Subject: [cdt-dev] IASTInitializerList getClauses()
Importance: Low

Dear all,

I am trying to iterate through the initializers of an array and experienceing the features of getClause().

In a declaration like
int a [2][2]={1,{2,3}};

the call of .getClause on the top level list will only return one element ({2,3}). The comment on getClause() says
"Depending on how the AST is created, trivial elements will be filtered out".
However, in the CDT AST browser, I see the IASTLiteralExpression of 1. I do not seem to be able to access it with
getChildren() either.

Any idea?

Best Regards,

Andreas

-- 
Andreas Graf
BDM Automotive
Mobil: +49 (0) 151-10860479 (preferred)
Tel.: +49 (0) 7231 / 1 54 71-0
Fax.: +49 (0) 7231 / 1 54 71-29


Web: http://www.itemis.de
Mail: andreas.graf@xxxxxxxxx
Xing: http://www.xing.com/profile/Andreas_Graf
Twitter: http://www.twitter.com/grafandreas
Blog: http://5ise.quanxinquanyi.de

itemis GmbH
Blücherstrasse 32
D-75177 Pforzheim
Rechtlicher Hinweis:
Amtsgericht Mannheim, HRB 50700996
Ust.Id.Nr.: DE250574762
Geschäftsführer: Sebastian Neus