1// RUN: %check_clang_tidy %s darwin-avoid-spinlock %t
2
3typedef int OSSpinLock;
4
5void OSSpinlockLock(OSSpinLock *l);
6void OSSpinlockTry(OSSpinLock *l);
7void OSSpinlockUnlock(OSSpinLock *l);
8
9@implementation Foo
10- (void)f {
11 int i = 1;
12 OSSpinlockLock(l: &i);
13 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use os_unfair_lock_lock() or dispatch queue APIs instead of the deprecated OSSpinLock [darwin-avoid-spinlock]
14 OSSpinlockTry(l: &i);
15 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use os_unfair_lock_lock() or dispatch queue APIs instead of the deprecated OSSpinLock [darwin-avoid-spinlock]
16 OSSpinlockUnlock(l: &i);
17 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use os_unfair_lock_lock() or dispatch queue APIs instead of the deprecated OSSpinLock [darwin-avoid-spinlock]
18}
19@end
20

source code of clang-tools-extra/test/clang-tidy/checkers/darwin/avoid-spinlock.m