summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/objc-avoid-spinlock.m
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/objc-avoid-spinlock.m')
-rw-r--r--clang-tools-extra/test/clang-tidy/objc-avoid-spinlock.m15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/objc-avoid-spinlock.m b/clang-tools-extra/test/clang-tidy/objc-avoid-spinlock.m
new file mode 100644
index 00000000000..f9f05cb05a2
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/objc-avoid-spinlock.m
@@ -0,0 +1,15 @@
+// RUN: %check_clang_tidy %s objc-avoid-spinlock %t
+
+typedef int OSSpinLock;
+
+@implementation Foo
+- (void)f {
+ int i = 1;
+ OSSpinlockLock(&i);
+ // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use os_unfair_lock_lock() or dispatch queue APIs instead of the deprecated OSSpinLock [objc-avoid-spinlock]
+ OSSpinlockTry(&i);
+ // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use os_unfair_lock_lock() or dispatch queue APIs instead of the deprecated OSSpinLock [objc-avoid-spinlock]
+ OSSpinlockUnlock(&i);
+ // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use os_unfair_lock_lock() or dispatch queue APIs instead of the deprecated OSSpinLock [objc-avoid-spinlock]
+}
+@end
OpenPOWER on IntegriCloud