[llvm] b24b179 - Revert "[ADT][ConcurrentHashTable] Change thread_local to LLVM_THREAD_LOCAL inside unit test."
Alexey Lapshin via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 5 19:58:15 PDT 2023
Author: Alexey Lapshin
Date: 2023-04-06T04:55:26+02:00
New Revision: b24b179b1ae8f83870ecec47e377deabe0debab4
URL: https://github.com/llvm/llvm-project/commit/b24b179b1ae8f83870ecec47e377deabe0debab4
DIFF: https://github.com/llvm/llvm-project/commit/b24b179b1ae8f83870ecec47e377deabe0debab4.diff
LOG: Revert "[ADT][ConcurrentHashTable] Change thread_local to LLVM_THREAD_LOCAL inside unit test."
This reverts commit 9ef701318b4590e1fa8bb61906d5957d7b1f6a2f.
Added:
Modified:
llvm/unittests/ADT/ConcurrentHashtableTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/ADT/ConcurrentHashtableTest.cpp b/llvm/unittests/ADT/ConcurrentHashtableTest.cpp
index b76ace23120f6..8138633bc6de9 100644
--- a/llvm/unittests/ADT/ConcurrentHashtableTest.cpp
+++ b/llvm/unittests/ADT/ConcurrentHashtableTest.cpp
@@ -36,27 +36,19 @@ class String {
std::array<char, 0x20> ExtraData;
};
-static LLVM_THREAD_LOCAL BumpPtrAllocator *ThreadLocalAllocator = nullptr;
+static thread_local BumpPtrAllocator ThreadLocalAllocator;
class PerThreadAllocator : public AllocatorBase<PerThreadAllocator> {
public:
inline LLVM_ATTRIBUTE_RETURNS_NONNULL void *Allocate(size_t Size,
size_t Alignment) {
- return getAllocatorPtr()->Allocate(Size, Align(Alignment));
+ return ThreadLocalAllocator.Allocate(Size, Align(Alignment));
}
- inline size_t getBytesAllocated() {
- return getAllocatorPtr()->getBytesAllocated();
+ inline size_t getBytesAllocated() const {
+ return ThreadLocalAllocator.getBytesAllocated();
}
// Pull in base class overloads.
using AllocatorBase<PerThreadAllocator>::Allocate;
-
-protected:
- BumpPtrAllocator *getAllocatorPtr() {
- if (ThreadLocalAllocator == nullptr)
- ThreadLocalAllocator = new BumpPtrAllocator();
-
- return ThreadLocalAllocator;
- }
} Allocator;
TEST(ConcurrentHashTableTest, AddStringEntries) {
More information about the llvm-commits
mailing list