10#include "clang/AST/ASTContext.h"
11#include "clang/ASTMatchers/ASTMatchFinder.h"
19 callExpr(callee((functionDecl(hasAnyName(
20 "OSSpinlockLock",
"OSSpinlockUnlock",
"OSSpinlockTry")))))
26 const auto *MatchedExpr = Result.Nodes.getNodeAs<CallExpr>(
"spinlock");
27 diag(MatchedExpr->getBeginLoc(),
28 "use os_unfair_lock_lock() or dispatch queue APIs instead of the "
29 "deprecated OSSpinLock");
DiagnosticBuilder diag(SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level=DiagnosticIDs::Warning)
Add a diagnostic with the check's name.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.