| 1 | // RUN: %check_clang_tidy %s darwin-avoid-spinlock %t |
| 2 | |
| 3 | typedef int OSSpinLock; |
| 4 | |
| 5 | void OSSpinlockLock(OSSpinLock *l); |
| 6 | void OSSpinlockTry(OSSpinLock *l); |
| 7 | void 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 | |