[cfe-dev] Accessing number of template parameter for a record type

Awanish Pandey via cfe-dev cfe-dev at lists.llvm.org
Sun Dec 8 23:37:31 PST 2019


Hi Richard,

Thanks for the suggestion. Yes, I have already retrieved that before the
desugaring. I want to access this value after the desugaring. The main
issue is after the desugaring it becomes the RecordType, in this type the
number of parameters is always the same.
So, I think, I have to pass this information in the RecordType even after
desugaring. What will be the best way to achieve this goal?


On Mon, Dec 9, 2019 at 12:59 PM Richard Smith <richard at metafoo.co.uk> wrote:

> On Sat, 7 Dec 2019 at 00:12, Awanish Pandey via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Dear all,
>>
>> I want to access the number of parameters given to a template class
>> during object creation in *collectTemplateParams*() ( in
>> CGDebugInfo.cpp).
>>
>> Ex
>> foo<int,>        a; // I want 1
>> foo<int,char> b; // I want 2
>> assuming *foo* is template class and its default parameters are <
>> *char,char*>
>>
>> In  *collectTemplateParams*(), I can find actual number of parameters,
>> which is after desugaring the *templateSpecialization* type.
>>
>> Is there any way that can give me the parameters count?
>>
>
> You're looking for the number of template arguments, not the number of
> template parameters. You can find that by looking at
> TemplateSpecializationType::getNumArgs() (prior to desugaring, which will
> remove the difference between the types of a and b).
>


-- 
Thanking You
Awanish Pandey
PhD, CSE
IIT Kanpur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191209/4c101990/attachment.html>


More information about the cfe-dev mailing list