10 #include "clang/AST/ASTContext.h"
11 #include "clang/ASTMatchers/ASTMatchFinder.h"
19 void AvoidSpinlockCheck::registerMatchers(MatchFinder *Finder) {
21 callExpr(callee((functionDecl(hasAnyName(
22 "OSSpinlockLock",
"OSSpinlockUnlock",
"OSSpinlockTry")))))
27 void AvoidSpinlockCheck::check(
const MatchFinder::MatchResult &Result) {
28 const auto *MatchedExpr = Result.Nodes.getNodeAs<CallExpr>(
"spinlock");
29 diag(MatchedExpr->getBeginLoc(),
30 "use os_unfair_lock_lock() or dispatch queue APIs instead of the "
31 "deprecated OSSpinLock");