10#include "clang/AST/ASTContext.h"
11#include "clang/ASTMatchers/ASTMatchFinder.h"
12#include "clang/ASTMatchers/ASTMatchers.h"
19 ast_matchers::MatchFinder *Finder) {
22 cxxMethodDecl(parameterCountIs(0), hasOverloadedOperatorName(
"&"))
27 Finder->addMatcher(functionDecl(unless(cxxMethodDecl()), parameterCountIs(1),
28 hasOverloadedOperatorName(
"&"))
34 const auto *
Decl = Result.Nodes.getNodeAs<FunctionDecl>(
"overload");
36 "do not overload unary operator&, it is dangerous.");
const FunctionDecl * Decl
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.