10#include "clang/AST/ASTContext.h"
11#include "clang/ASTMatchers/ASTMatchFinder.h"
19 cxxMethodDecl(anyOf(isOverride(), isVirtual()),
20 hasAnyParameter(parmVarDecl(hasInitializer(expr()))))
26 const auto *MatchedDecl = Result.Nodes.getNodeAs<CXXMethodDecl>(
"Decl");
27 diag(MatchedDecl->getLocation(),
28 "default arguments on virtual or override methods are prohibited");
DiagnosticBuilder diag(SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level=DiagnosticIDs::Warning)
Add a diagnostic with the check's name.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.