
This relands the patch
67b298f6d8
,
with some more testcases.
The `undefined symbol` error mentioned in
https://github.com/llvm/llvm-project/issues/61065#issuecomment-1517725811
doesn't exist anymore from our internal tests.
Fixes #61065, #134739
---------
Co-authored-by: Viktoriia Bakalova <bakalova@google.com>
35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
// RUN: rm -rf %t
|
|
// RUN: mkdir %t
|
|
// RUN: split-file %s %t
|
|
//
|
|
// RUN: %clang -std=c++20 -Wno-experimental-header-units -fmodule-header %t/RelaxedAtomic.h -o %t/RelaxedAtomic.pcm
|
|
// RUN: %clang -std=c++20 -Wno-experimental-header-units -fmodule-header -fmodule-file=%t/RelaxedAtomic.pcm %t/SharedMutex.h -o %t/SharedMutex.pcm
|
|
// 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
|
|
//--- RelaxedAtomic.h
|
|
struct relaxed_atomic_base {
|
|
relaxed_atomic_base(int) {}
|
|
};
|
|
|
|
struct relaxed_atomic : relaxed_atomic_base {
|
|
using relaxed_atomic_base::relaxed_atomic_base; // constructor
|
|
};
|
|
|
|
//--- SharedMutex.h
|
|
import "RelaxedAtomic.h";
|
|
|
|
inline void getMaxDeferredReaders() {
|
|
static relaxed_atomic cache{0};
|
|
}
|
|
|
|
//--- ThreadLocalDetail.h
|
|
import "RelaxedAtomic.h";
|
|
|
|
struct noncopyable {
|
|
noncopyable(const noncopyable&) = delete;
|
|
};
|
|
|
|
struct StaticMetaBase {
|
|
relaxed_atomic nextId_{0};
|
|
noncopyable ncp;
|
|
};
|