[cfe-dev] Clang API: specialise a class template and all its members
Dimitar Dobrev via cfe-dev
cfe-dev at lists.llvm.org
Mon Mar 14 09:22:17 PDT 2016
Thank you for your reply. Have you ever used this API? If so, I would really appreciate a few lines of code because some of the parameters I have no idea how to get. Some, such as "TemplateParameterLists", are all clear but where would I get Scope from, for example?
-------- Original Message --------
Subject: Re: [cfe-dev] Clang API: specialise a class template and all its members
Local Time: 14 март 2016 6:14 PM
UTC Time: 14 март 2016 16:14
From: v.g.vassilev at gmail.com
To: dpldobrev at protonmail.com,cfe-dev at lists.llvm.org
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 http://clang.llvm.org/doxygen/classclang_1_1Sema.html#a959c3ea985edf81ee649c0325ad623f8
Ideally calling this interface with the right set of arguments would create a proper specialization or a diagnostic.
--Vassil
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/ec24554d/attachment.html>
More information about the cfe-dev
mailing list