| 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(&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(&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(&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 |