10#include "clang/AST/ASTContext.h"
11#include "clang/AST/DeclObjC.h"
12#include "clang/ASTMatchers/ASTMatchFinder.h"
24 objcMethodDecl(isInstanceMethod(), hasName(
"dealloc"),
25 hasDeclContext(objcCategoryImplDecl().bind(
"impl")))
31 const auto *DeallocDecl = Result.Nodes.getNodeAs<ObjCMethodDecl>(
"dealloc");
32 const auto *CID = Result.Nodes.getNodeAs<ObjCCategoryImplDecl>(
"impl");
33 assert(DeallocDecl !=
nullptr);
34 diag(DeallocDecl->getLocation(),
"category %0 should not implement -dealloc")
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.