| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: mkdir %t |
| 3 |
// RUN: split-file %s %t |
| 4 |
// |
| 5 |
// RUN: %clang -std=c++20 -Wno-experimental-header-units -fmodule-header %t/RelaxedAtomic.h -o %t/RelaxedAtomic.pcm |
| 6 |
// RUN: %clang -std=c++20 -Wno-experimental-header-units -fmodule-header -fmodule-file=%t/RelaxedAtomic.pcm %t/SharedMutex.h -o %t/SharedMutex.pcm |
| 7 |
// RUN: %clang -std=c++20 -Wno-experimental-header-units -fmodule-header -fmodule-file=%t/SharedMutex.pcm -fmodule-file=%t/RelaxedAtomic.pcm %t/ThreadLocalDetail.h -o %t/ThreadLocalDetail.pcm |
| 8 |
//--- RelaxedAtomic.h |
| 9 |
struct relaxed_atomic_base { |
| 10 |
relaxed_atomic_base(int) {} |
| 11 |
}; |
| 12 |
|
| 13 |
struct relaxed_atomic : relaxed_atomic_base { |
| 14 |
using relaxed_atomic_base::relaxed_atomic_base; // constructor |
| 15 |
}; |
| 16 |
|
| 17 |
//--- SharedMutex.h |
| 18 |
import "RelaxedAtomic.h"; |
| 19 |
|
| 20 |
inline void getMaxDeferredReaders() { |
| 21 |
static relaxed_atomic cache{0}; |
| 22 |
} |
| 23 |
|
| 24 |
//--- ThreadLocalDetail.h |
| 25 |
import "RelaxedAtomic.h"; |
| 26 |
|
| 27 |
struct noncopyable { |
| 28 |
noncopyable(const noncopyable&) = delete; |
| 29 |
}; |
| 30 |
|
| 31 |
struct StaticMetaBase { |
| 32 |
relaxed_atomic nextId_{0}; |
| 33 |
noncopyable ncp; |
| 34 |
}; |