10#include "clang/AST/ASTContext.h"
11#include "clang/ASTMatchers/ASTMatchFinder.h"
20 ast_matchers::internal::Matcher<ObjCInterfaceDecl>, Base) {
21 const ObjCInterfaceDecl *InterfaceDecl = Node.getClassInterface();
22 return Base.matches(*InterfaceDecl, Finder, Builder);
26 ast_matchers::internal::Matcher<ObjCMethodDecl>, Base) {
28 return llvm::any_of(Node.instance_methods(), [&](
const ObjCMethodDecl *I) {
29 return Base.matches(*I, Finder, Builder);
38 hasName(
"isEqual:"), isInstanceMethod(),
39 hasDeclContext(objcImplementationDecl(
40 hasInterface(isDirectlyDerivedFrom(
"NSObject")),
41 unless(hasInstanceMethod(hasName(
"hash"))))
47 const auto *ID = Result.Nodes.getNodeAs<ObjCImplementationDecl>(
"impl");
48 diag(ID->getLocation(),
"%0 implements -isEqual: without implementing -hash")
void registerMatchers(ast_matchers::MatchFinder *Finder) override
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
AST_MATCHER_P(Stmt, isStatementIdenticalToBoundNode, std::string, ID)