TemplateArgumentList of out-of-line method of class template

Hi all,

Is it possible to get TemplateArgumentList from declaration of out-of-line method of class template, e.g.

template<typename T1, typename T2>
class B
    static void hello();

template<typename T1, typename T2>
void B<T1, T2>::hello() // <---- Here



I'm trying to set up one-one relationships between TemplateTypeParmDecl's in method definition and in base ClassTemplateDecl (e.g. find out that T1 inside hello() definition refers to the first parameter of B).

I've tried to use template parameter declaration obtained from DeclaratorDecl::getTemplateParameterList(), however 1) there may be several template lists in CXXMethodDecl; 2) parameter ordering is not necessarily the same as in parameter list of B. Using TemplateArgumentList in B<T1, T2>::hello() should be more reliable.


Have you looked at DeclaratorDecl::getQualifier?