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)?

That's what I thought. Thanks a lot!

On Jun 10, 2014, at 8:06 PM, "Sergey Prigogin" <eclipse.sprigogin@xxxxxxxxx<mailto:eclipse.sprigogin@xxxxxxxxx>> wrote:




On Tue, Jun 10, 2014 at 7:59 PM, Ayupov, Andrey <andrey.ayupov@xxxxxxxxx<mailto:andrey.ayupov@xxxxxxxxx>> wrote:
Thanks, Sergey! I'll give it a try. One clarification question though. If I start with binding "x", should not the binding already be for the specialized class? Meaning that the fields should be specialized even if I pass null To the getFields method.

In your example, yes. In a general case x itself may depend on template parameters.

-sergey

On Jun 10, 2014, at 6:33 PM, "Sergey Prigogin" <eclipse.sprigogin@xxxxxxxxx<mailto:eclipse.sprigogin@xxxxxxxxx><mailto:eclipse.sprigogin@xxxxxxxxx<mailto:eclipse.sprigogin@xxxxxxxxx>>> wrote:

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<mailto:andrey.ayupov@xxxxxxxxx><mailto:andrey.ayupov@xxxxxxxxx<mailto: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<mailto:cdt-dev@xxxxxxxxxxx><mailto:cdt-dev@xxxxxxxxxxx<mailto:cdt-dev@xxxxxxxxxxx>>
https://dev.eclipse.org/mailman/listinfo/cdt-dev


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

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


Back to the top