18 AST_MATCHER(FunctionDecl, isFuchsiaOverloadedOperator) {
19 if (
const auto *CXXMethodNode = dyn_cast<CXXMethodDecl>(&Node)) {
20 if (CXXMethodNode->isCopyAssignmentOperator() ||
21 CXXMethodNode->isMoveAssignmentOperator())
23 if (CXXMethodNode->getParent()->isLambda())
26 return Node.isOverloadedOperator();
30 void OverloadedOperatorCheck::registerMatchers(MatchFinder *Finder) {
31 Finder->addMatcher(functionDecl(isFuchsiaOverloadedOperator()).bind(
"decl"),
35 void OverloadedOperatorCheck::check(
const MatchFinder::MatchResult &Result) {
36 const auto *D = Result.Nodes.getNodeAs<FunctionDecl>(
"decl");
37 assert(D &&
"No FunctionDecl captured!");
39 SourceLocation
Loc = D->getBeginLoc();
41 diag(
Loc,
"overloading %0 is disallowed") << D;