1 // RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -Wthread-safety-beta -Wno-objc-root-class %s
3 class __attribute__((lockable)) Lock {
5 void Acquire() __attribute__((exclusive_lock_function())) {}
6 void Release() __attribute__((unlock_function())) {}
9 class __attribute__((scoped_lockable)) AutoLock {
11 AutoLock(Lock &lock) __attribute__((exclusive_lock_function(lock)))
15 ~AutoLock() __attribute__((unlock_function())) { lock_.Release(); }
21 @interface MyInterface {
27 - (void)incrementValue;
28 - (void)decrementValue;
32 @implementation MyInterface
34 - (void)incrementValue {
39 - (void)decrementValue {
40 lock_.Acquire(); // expected-note{{mutex acquired here}}
42 } // expected-warning{{mutex 'self->lock_' is still held at the end of function}}