10#include "clang/ASTMatchers/ASTMatchFinder.h"
21 cxxMethodDecl(ofClass(classTemplateSpecializationDecl(
22 unless(isExplicitTemplateSpecialization()))
23 .bind(
"specialization")),
24 isVirtual(), unless(isUsed()),
25 unless(cxxDestructorDecl(isDefaulted())))
31 const MatchFinder::MatchResult &Result) {
32 const auto *ImplicitSpecialization =
33 Result.Nodes.getNodeAs<ClassTemplateSpecializationDecl>(
"specialization");
34 const auto *MethodDecl = Result.Nodes.getNodeAs<CXXMethodDecl>(
"method");
36 diag(MethodDecl->getLocation(),
37 "unspecified virtual member function instantiation; the virtual "
38 "member function is not instantiated but it might be with a "
39 "different compiler");
40 diag(ImplicitSpecialization->getPointOfInstantiation(),
41 "template instantiated here", DiagnosticIDs::Note);
::clang::DynTypedNode Node
DiagnosticBuilder diag(SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level=DiagnosticIDs::Warning)
Add a diagnostic with the check's name.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
AST_MATCHER(Expr, isMacroID)