[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [cdt-dev] IScope.getPhysicalNode() not available in CDT 4.0
|
Nope. My general advice is to stay away from Scopes. Scopes are really only
there for name look up needed by binding resolution, and actually should be
an internal interface.
You should be able to walk up from the IASTDeclarator all the way to the
IASTTranslationUnit. But if you need you can stop in the function definition
along the way.
Doug Schaefer, QNX Software Systems
Eclipse CDT Project Lead, http://cdtdoug.blogspot.com
> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On
> Behalf Of Beth Tibbitts
> Sent: Thursday, April 26, 2007 11:39 AM
> To: CDT General developers list.
> Subject: RE: [cdt-dev] IScope.getPhysicalNode() not available in CDT 4.0
>
> >Maybe I'm missing something, but doesn't getParent() do what you need?
> Do you mean IScope.getParent()? Seems like this one be one level higher
> than the scope itself.
> or IASTDeclarator.getParent()? I'm trying to figure out if that gives
> the
> original intent of the code. It's not apparent.
>
> Basically, CDT 3.1 had IScope.getPhysicalNode() which returned an
> IASTNode.
> CDT 4.0 doesn't have this method on IScope.
> (Can I get it from the Binding? it's not obvious to me anyway how to get
> the IASTNode from the IScope.)
>
> Sorry if I'm being dense...
>
>
> ...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
>
>
>
> Doug Schaefer
> <DSchaefer@xxxxxx
> m> To
> Sent by: "CDT General developers list."
> cdt-dev-bounces@e <cdt-dev@xxxxxxxxxxx>
> clipse.org cc
>
> Subject
> 04/25/2007 01:51 RE: [cdt-dev]
> PM IScope.getPhysicalNode() not
> available in CDT 4.0
>
> Please respond to
> "CDT General
> developers list."
> <cdt-dev@eclipse.
> org>
>
>
>
>
>
>
> Maybe I'm missing something, but doesn't getParent() do what you need?
>
> Doug Schaefer, QNX Software Systems
> Eclipse CDT Project Lead, http://cdtdoug.blogspot.com,
>
>
> > -----Original Message-----
> > From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
> On
> > Behalf Of Beth Tibbitts
> > Sent: Wednesday, April 25, 2007 10:29 AM
> > To: cdt-dev@xxxxxxxxxxx
> > Subject: [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
> >
> > _______________________________________________
> > cdt-dev mailing list
> > cdt-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/cdt-dev
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev