11 #include "clang/AST/ASTContext.h" 12 #include "clang/ASTMatchers/ASTMatchFinder.h" 20 void AvoidSpinlockCheck::registerMatchers(MatchFinder *Finder) {
22 callExpr(callee((functionDecl(hasAnyName(
23 "OSSpinlockLock",
"OSSpinlockUnlock",
"OSSpinlockTry")))))
28 void AvoidSpinlockCheck::check(
const MatchFinder::MatchResult &
Result) {
29 const auto *MatchedExpr = Result.Nodes.getNodeAs<CallExpr>(
"spinlock");
30 diag(MatchedExpr->getBeginLoc(),
31 "use os_unfair_lock_lock() or dispatch queue APIs instead of the " 32 "deprecated OSSpinLock");
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//