[cfe-dev] libclang nested template FIELD_DECL

Fredrik Ehnbom quarnster at gmail.com
Wed Apr 18 10:24:43 PDT 2012


Resending since I've seen no reply yet.

Same thing with the cursors for a typedef:

typedef  A< TT2<B, B2> > ZZ;

How do I figure out whether B2 belongs to A or TT2 if both the templates
classes A and TT2 can take a variable amount of template parameters, and A,
TT2, B, B2 are all children of ZZ?

Thanks.

/f

Den 14 april 2012 12:37 skrev Fredrik Ehnbom <quarnster at gmail.com>:

> I'm walking through the cursor in a translation unit and the cursor for
> "test" in the following code is of kind FIELD_DECL and has four children:
> TEMPLATE_REF -> A
> TEMPLATE_REF -> TT2
> TYPE_REF -> B
> TYPE_REF -> B2
>
> Since they are all children of "test", how can I determine whether B2 is
> an argument in the instantiation of the template TT2 or A? I tried
> calling clang_getCursorReferenceNameRange with CXNameRange_WantTemplateArgs
> on each of these 5 cursor, but in every case the returned range would equal
> the result of clang_getCursorExtent so that didn't .
>
> Any ideas?
>
> Thanks
>
>
> template <typename T, typename B=int>
> class A
> {
> };
>
> template <typename T2, typename T3=int>
> class TT2
> {
> };
>
> class B
> {
> };
>
> class B2
> {
> };
>
> class C
> {
>     A< TT2<B, B2> > test;
> };
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120418/c2cd9d46/attachment.html>


More information about the cfe-dev mailing list