Debian Codegraph @

clang/test/SemaObjCXX/warn-thread-safety-analysis.mm

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -Wthread-safety-beta -Wno-objc-root-class %s
2
3 #include "thread-safety-analysis.h"
4
5 @interface MyInterface {
6 @private
7 Lock lock_;
8 int value_;
9 }
10
11 - (void)incrementValue;
12 - (void)decrementValue;
13
14 @end
15
16 @implementation MyInterface
17
18 - (void)incrementValue {
19 AutoLock lock(lock_);
20 value_ += 1;
21 }
22
23 - (void)decrementValue {
24 lock_.Acquire(); // expected-note{{mutex acquired here}}
25 value_ -= 1;
26 } // expected-warning{{mutex 'self->lock_' is still held at the end of function}}
27
28 @end