On Tue, Feb 9, 2016 at 9:03 AM, Cong Liu via cfe-commits <cfe-commits@lists.llvm.org> wrote: > Hi Richard, > > I need to use the function (line 747 of ASTMatchFinder.cpp): > > static CXXRecordDecl *getAsCXXRecordDecl(const Type *TypeNode) > > in the misc-virtual-near-miss check of clang-tidy, because it can correctly > get the declaration of a template type, while QualType::getAsCXXRecordDecl > cannot.
In what sense correctly? Type::getAsCXXRecordDecl should get the CXXRecordDecl in every case where we know which record will be used. 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, but it's not generally correct to make that assumption. I'm not really sure why we're using this sometimes-incorrect mechanism in MatchASTVisitor:classIsDerivedFrom; that seems like a bug. > But this function is not accessible in clang-tidy check. I think we should > make this function public accessible since its useful. Could you please tell > me how to do it? Thanks a lot. > > Best regards, > Cong > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits