[cfe-dev] libclang nested template FIELD_DECL

Fredrik Ehnbom quarnster at gmail.com
Sat Apr 14 03:37:00 PDT 2012


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/20120414/30c55804/attachment.html>


More information about the cfe-dev mailing list