[cfe-dev] Clang API: specialise a class template and all its members

Vassil Vassilev via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 14 09:14:50 PDT 2016

On 12/03/16 00:53, Dimitar Dobrev via cfe-dev wrote:
> Hello all,
> I have a clang::ClassTemplateDecl object with a single template 
> argument. I want to specialise it for a certain type (void*). I use 
> the following code:
>         clang::TemplateArgument t(C->getASTContext().VoidPtrTy);
>         auto CTSVoidStar = 
> clang::ClassTemplateSpecializationDecl::Create(C->getASTContext(),
>             clang::TagTypeKind::TTK_Class, CTS->getDeclContext(), 
> clang::SourceLocation(), clang::SourceLocation(),
>             CTS->getSpecializedTemplate(), &t, 
> CTS->getTemplateArgs().size(), CTS);
> where CTS->getSpecializedTemplate() is my ClassTemplateDecl. The 
> problem with it is while according to CTSVoidStar->dump() it looks 
> correct, it lacks any functions, and it's the functions that I need - 
> their mangled names in particular. I know for sure that my 
> ClassTemplateDecl does have functions. My question is how to get a 
> complete specialisation, with all members and not just the class 
> itself. Thank you.
Perhaps you could have a look at 
Ideally calling this interface with the right set of arguments would 
create a proper specialization or a diagnostic.
> Regards,
> Dimitar Dobrev
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160314/97f97d3f/attachment.html>

More information about the cfe-dev mailing list