Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] How to find binding definition

Hi All,

      How can we find the definition of a given binding?

      Say, I have a class like below:
      #include "Class2.h"
      class Class1 {
                  Class2 attribute1;

And Class2 is declared in a different project. I have the
ASTTranslationUnit of this file, which I am processing and find the
attribute with type
Class2(a binding). I need to identify the file containing the declaration
of this binding type. How can I achieve this programmatically?

One of the ways I found that can be used was to get the index(IIndex) of
project containing Class1 and then finding the binding with it by calling:

This method returns me back an array of IndexName. This is fine if there is
only one definition for the given binding. But if there are multiple
definitions(say, there is a class named Class2 declared in a third project
as well) then this method would return multiple IndexNames. In this,
scenario how can I identify the correct definition referenced in the

Is there any other way to get the definition? Right now I just want to find
the file containing the referenced definition. I am using CDT 5.0.


Back to the top