Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] AST: How to discover now whether ICPPClassScope isICPPTemplateScope?

Your best choice is to work with the bindings rather than with the
In CDT 6.0 we have the method IBinding.getOwner() for that. In older CDT
versions you only have ICPPMember.getClassOwner(), which provides the 
class for the members. In your case this should be sufficient.

If you do need or want to work with the scope, you can also use 
ICPPClassScope.getClassType() to find the binding for the class scope.
The binding will tell you whether you are looking at a template or not.

The change is not a bug, in fact the template scopes itself caused lots
of issues because they destroy the tree structure of scopes. The
for the change is discussed here:


> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx 
> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Andrey Tretyakov
> Sent: Wednesday, June 24, 2009 6:37 PM
> To: cdt-dev@xxxxxxxxxxx
> Subject: [cdt-dev] AST: How to discover now whether 
> ICPPClassScope isICPPTemplateScope?
> Importance: Low
> Hello!
> I've found that modifications in the AST in CDT 6.0 had led 
> to the missing information, important to me.
> For example, take the method		std::basic_string<...>::length()
> 1) Open the header	
> /usr/include/c++/4.3/bits/basic_string.h	from Eclipse  
> IDE;
> 2) Get ICPPBinding for the method	length()		
> 	//it's instanceof ICPPMethod  
> ("length")
> 3) ICPPScope scope = (ICPPScope) binding.getScope();		
> 	//scope is  
> instanceof ICPPClassScope ("basic_string"). OK.
> 4) scope = (ICPPScope) scope.getParent();			
> 	//scope is already instanceof  
> ICPPNamespaceScope ("std")!!!
> In CDT 5.0 on step 4) scope was ICPPTemplateScope, but now I 
> cannot discover that "basic_string" needs the Template Parameters.
> Is it bug or is there any other way to solve this problem?
> P.S.1. When I use length() method from my source file (.cpp) 
> and get ICPPBinding for it - there is no problems (I get 
> ClassInstance, ClassTemplate, etc). But I want to work with 
> headers too.
> P.S.2. I need universal method working on CDT 4.0, 5.0, 6.0.
> Thanks for any help.
> Best regards,
>                Andrey.
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx

Back to the top