[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-dev] IScope.getPhysicalNode() not available in CDT 4.0
|
One of my last remaining things to convert our PTP analysis code to CDT
4.0 ...
The problem is that a class of ours, "Symbol" contains a method to get
the defining function it's found within.
It relied on IScope to supply the getPhysicalNode() method, which existed
in CDT 3.1 but not CDT 4.0.
Its ctor supplies:
public Symbol( IASTDeclarator declarator, IASTDeclaration declaration)
whose args are core.dom.ast classes.
A simplified version of this method is provided here (without checks for
null, exception catching etc.)
Any ideas on how to get the containing node from an IASTDeclarator?
/**
* getDefiningFunction - get the function in which declartor is defined
* @return IASTNode - either IASTTranslationUnit or
IASTFunctionDefinition
*/
public IASTNode getDefiningFunction()
{
IScope scope = declarator_.getName().resolveBinding().getScope
();//simplified
if (scope==).null) return null;
IASTNode node node = scope.getPhysicalNode(); // *** <=== doesn't
exist in CDT 4.0
// keep moving up the tree until we find the node
while(true) {
if (node==null) return null;
if (node instanceof IASTTranslationUnit) return node; //
global dict
if (node instanceof IASTFunctionDefinition) return node; //
our function
node = node.getParent();
}
}
...Beth
Beth Tibbitts (859) 243-4981 (TL 545-4981)
High Productivity Tools / Parallel Tools http://eclipse.org/ptp
IBM T.J.Watson Research Center
Mailing Address: IBM Corp., 455 Park Place, Lexington, KY 40511