[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaObjCXX / thread-safety-analysis.h
blobf657b7e50a9c4eba2b21b352621696823fdf5258
1 class __attribute__((lockable)) Lock {
2 public:
3 void Acquire() __attribute__((exclusive_lock_function())) {}
4 void Release() __attribute__((unlock_function())) {}
5 };
7 class __attribute__((scoped_lockable)) AutoLock {
8 public:
9 AutoLock(Lock &lock) __attribute__((exclusive_lock_function(lock)))
10 : lock_(lock) {
11 lock.Acquire();
13 ~AutoLock() __attribute__((unlock_function())) { lock_.Release(); }
15 private:
16 Lock &lock_;