[cfe-dev] TemplateArgumentList of out-of-line method of class template

Eli Friedman eli.friedman at gmail.com
Tue Oct 30 14:01:33 PDT 2012


On Tue, Oct 30, 2012 at 1:43 PM, Konstantin Tokarev <annulen at yandex.ru> wrote:
>
>
> 28.10.2012, 15:12, "Konstantin Tokarev" <annulen at yandex.ru>:
>> 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
>> {
>> public:
>>     static void hello();
>> };
>>
>> template<typename T1, typename T2>
>> void B<T1, T2>::hello()  // <---- Here
>> {
>> }
>>
>> ?
>>
>> Background:
>>
>> 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.
>
> Bump.

Have you looked at DeclaratorDecl::getQualifier?

-Eli




More information about the cfe-dev mailing list