Skip to content

Commit 91f057e

Browse files
committed
[scudo] Add missing thread-safety analysis annotations.
This avoids new warnings from `-Wthread-safety` after #67776, see #67795. Note that this are not really useful since thread safety analysis is disabled anyway here: llvm-project/compiler-rt/lib/scudo/standalone/tsd_exclusive.h:172
1 parent 853e126 commit 91f057e

File tree

1 file changed

+5
-3
lines changed
  • compiler-rt/lib/scudo/standalone

1 file changed

+5
-3
lines changed

compiler-rt/lib/scudo/standalone/tsd.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ template <class Allocator> struct alignas(SCUDO_CACHE_LINE_SIZE) TSD {
5353
inline void unlock() NO_THREAD_SAFETY_ANALYSIS { Mutex.unlock(); }
5454
inline uptr getPrecedence() { return atomic_load_relaxed(&Precedence); }
5555

56-
void commitBack(Allocator *Instance) ASSERT_CAPABILITY(Mutex) {
56+
void commitBack(Allocator *Instance) ASSERT_CAPABILITY(Mutex)
57+
REQUIRES(Mutex) {
5758
Instance->commitBack(this);
5859
}
5960

@@ -66,11 +67,12 @@ template <class Allocator> struct alignas(SCUDO_CACHE_LINE_SIZE) TSD {
6667
// TODO(chiahungduan): Ideally, we want to do `Mutex.assertHeld` but acquiring
6768
// TSD doesn't always require holding the lock. Add this assertion while the
6869
// lock is always acquired.
69-
typename Allocator::CacheT &getCache() ASSERT_CAPABILITY(Mutex) {
70+
typename Allocator::CacheT &getCache() ASSERT_CAPABILITY(Mutex)
71+
REQUIRES(Mutex) {
7072
return Cache;
7173
}
7274
typename Allocator::QuarantineCacheT &getQuarantineCache()
73-
ASSERT_CAPABILITY(Mutex) {
75+
ASSERT_CAPABILITY(Mutex) REQUIRES(Mutex) {
7476
return QuarantineCache;
7577
}
7678

0 commit comments

Comments
 (0)