Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] what should IASTNode exactly be in ICPPClassSpecialization#getFields(IASTNode)?

Ideally you should pass Foo<int> in both cases since this is the point of instantiation, but in reality any node in the same scope would do as long as there are no additional declarations in between the two nodes that would change interpretation of Foo<int>.

-sergey


On Tue, Jun 10, 2014 at 6:17 PM, Ayupov, Andrey <andrey.ayupov@xxxxxxxxx> wrote:

Hi all,

 

I am trying to get specialized class fields and I need to pass an IASTNode object in order to call this method: ICPPClassSpecialization#getFields(IASTNode). I believe this IASTNode is there to let cdt know what class specialization I am going to generate fields for. But I am not sure what exactly that node should be. Let’s say I have the following class structure:

 

template <typename T>

struct Bla {

  T a;

}

template <typename T>

struct Foo {

    Bla<T> bla;

}

 

int main(int argc, char*argv[]) {

   Foo<int> x;

}

 

Now, for the binding resolved from name “x”, I want to get its fields, what would be the IASTNode I pass?

Let’s say I successfully got specialized fields for “x”.  Then I want to look inside field x.bla which also is instance of ICPPClassSpecialization, and I want to call getFields on it as well to get the specialized field “int a”, what IASTNode do I pass in this case? “Bla<T> bla” _expression_ seems to not have the specialization anymore for T.

 

Thanks for your time,

Andrey

 


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top