11 #include "clang/AST/ASTContext.h" 12 #include "clang/ASTMatchers/ASTMatchFinder.h" 20 void DefaultArgumentsCheck::registerMatchers(MatchFinder *Finder) {
22 cxxMethodDecl(anyOf(isOverride(), isVirtual()),
23 hasAnyParameter(parmVarDecl(hasInitializer(expr()))))
28 void DefaultArgumentsCheck::check(
const MatchFinder::MatchResult &
Result) {
29 const auto *MatchedDecl = Result.Nodes.getNodeAs<CXXMethodDecl>(
"Decl");
30 diag(MatchedDecl->getLocation(),
31 "default arguments on virtual or override methods are prohibited");
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//