Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Indexer not detecting any definitions(or occurences) in custom refactoring

Yes it does. I simply used the AST.getReferences(typeBinding) 

Thanks 



On Fri, Nov 27, 2015 at 10:35 AM, Corbat Thomas <thomas.corbat@xxxxxx> wrote:

Hi Krishna

 

Afaik, getDeclarations() only returns the elaborate type specifiers, used in declarations for this type, that are contained in the AST. So you won’t get all declarations of that type, but only those contained in the translation unit (or more specifically the parts of the translation unit that have been parsed in the AST you got CPPClassType as binding from).

 

Hope this helps!

Regards

Thomas

 

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Krishna Narasimhan
Sent: Donnerstag, November 26, 2015 7:18 PM
To: CDT General developers list. <cdt-dev@xxxxxxxxxxx>
Subject: Re: [cdt-dev] Indexer not detecting any definitions(or occurences) in custom refactoring

 

Hey,

   One more question. Does the CPPClassType also contain the declarations in getDeclarations()? Somehow that is throwing me a null pointer exception.

 

Basically, I am trying to detect something like this

 

 

struct StructType{

...

}

 

StructType structObj;

 

 

I want to be able to query for the structObj declaration from a ClassType object which I have.

 

On Wed, Nov 25, 2015 at 10:20 PM, Krishna Narasimhan <krishna.nm86@xxxxxxxxx> wrote:

Nathan,

   This is awesome. Thanks a lot

 

Sergey,

       I will look into that. But for my current purpose, Nathans help worked. But I would like to learn the fundas about this binding. As I have bigger flow analysis coming up. 

 

On Wed, Nov 25, 2015 at 7:24 PM, Nathan Ridge <zeratul976@xxxxxxxxxxx> wrote:

> What is the way to bind local variable names to their type definitions

The IBinding for the variable will be an IVariable, which has a getType() method.

> and also references?

To find references of a local variable, you need to search the AST rather than the index. You can do this with IASTTranslationUnit.getReferences(IBinding).

Regards,
Nate


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev

 

 


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top