File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,12 @@ class LOCKABLE AnnotatedMixin : public PARENT
103
103
}
104
104
105
105
using UniqueLock = std::unique_lock<PARENT>;
106
+ #ifdef __clang__
107
+ // ! For negative capabilities in the Clang Thread Safety Analysis.
108
+ // ! A negative requirement uses the EXCLUSIVE_LOCKS_REQUIRED attribute, in conjunction
109
+ // ! with the ! operator, to indicate that a mutex should not be held.
110
+ const AnnotatedMixin& operator !() const { return *this ; }
111
+ #endif // __clang__
106
112
};
107
113
108
114
/* *
Original file line number Diff line number Diff line change 60
60
// and should only be used when sync.h Mutex/LOCK/etc are not usable.
61
61
class LOCKABLE StdMutex : public std::mutex
62
62
{
63
+ public:
64
+ #ifdef __clang__
65
+ // ! For negative capabilities in the Clang Thread Safety Analysis.
66
+ // ! A negative requirement uses the EXCLUSIVE_LOCKS_REQUIRED attribute, in conjunction
67
+ // ! with the ! operator, to indicate that a mutex should not be held.
68
+ const StdMutex& operator !() const { return *this ; }
69
+ #endif // __clang__
63
70
};
64
71
65
72
// StdLockGuard provides an annotated version of std::lock_guard for us,
You can’t perform that action at this time.
0 commit comments