Need to use function "getAsCXXRecordDecl" of ASTMatchFinder.cpp in a clang-tidy check

Cong Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 16:15:19 PST 2016


Hi Richard,

Thank you for your reply. Yes, the case I need to deal with is like what
you said:

> If you want to make the assumption that the primary template will be
> used for an unknown specialization, you'll need something like that
> function in ASTMatchFinder.


For example,


   1.   template <typename T>
   2.   struct Base {};
   3.   template <typename T>
   4.   struct Derived : Base<T>{};
   5.
   6.   Derived<int> T1;

In this case, I need to firstly get the CXXBaseSpecifier from line 4, then
get the QualType of primary template (Base<T>), then get its declaration.
For this case, that function in ASTMatchFinder works but
Type::getAsCXXRecordDecl does not.

So, what do you suggest?

Best regards,
Cong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160210/5d508b16/attachment-0001.html>


More information about the cfe-commits mailing list