Skip to main content

[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

IScope.getParent()?  It returns another IScope.
But, then how do I get the AST node ??

...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




Back to the top