Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Can't find IASTExpressionList any more more in the CDT AST

Arguments of a function call is an array of IASTInitializerClause. Take a look at IASTFunctionCallExpression.getArguments().

-sergey

On Wed, Apr 21, 2010 at 2:25 PM, Beth Tibbitts <tibbitts@xxxxxxxxxx> wrote:

I'm debugging some of our PTP static analysis that makes heavy use of the CDT AST APIs.
The original author did a lot of 'instanceof' to discover things.
CDT 7.0 is giving a different behavior than CDT 6.0 did.

A particularly nasty bug now, it turns out, seems to be because a value that comes from a parameter list
isn't populated, probably because as this part of the program is descending down part of the AST,
it expects to find an IASTExpressionList node, and find the parameter in there.
But it never finds it.
In a visitor,
int visitor(IASTExpressions expr){
...
if(expr instanceof IASTExpressionList){ // this is never true
... do something
}
}
I seem to remember some things related to parameters being deprecated,
but IASTExpressionList itself isn't itself deprecated, and I never find one.
Anybody know what I should be looking for instead of this?
AHA.....
If I look at the nodes as they hit the visitor, it sort of looks like
the AST now no longer has an IASTExpressionList node at all.
I see the IASTFunctionCallExpression and then I see the IASTIDExpression for the function name and two UnaryExpressions (one for each arg),
not wrapped in an IASTExpressionList as it was before.

In fact, the DOM AST view shows this quite clearly. Should have looked more closely at (this part of) that sooner.

Nothing like composing a problem for a mailing list post to point the problem out to yourself.
I guess I'll just grab the parameters from the expressions that follow the IASTIDexpression for the call name.

If anyone has more introspection I should be seeing here, please let me know.
I am sort of curious why it changed.



...Beth

Beth Tibbitts
Eclipse Parallel Tools Platform http://eclipse.org/ptp
IBM STG Communications Protocols and Tools
Mailing Address: IBM Corp., Coldstream Research Campus, 745 West New Circle Road, Lexington, KY 40511


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top