Skip to content

Commit b24b179

Browse files
committed
Revert "[ADT][ConcurrentHashTable] Change thread_local to LLVM_THREAD_LOCAL inside unit test."
This reverts commit 9ef7013.
1 parent 2c57868 commit b24b179

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

llvm/unittests/ADT/ConcurrentHashtableTest.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,19 @@ class String {
3636
std::array<char, 0x20> ExtraData;
3737
};
3838

39-
static LLVM_THREAD_LOCAL BumpPtrAllocator *ThreadLocalAllocator = nullptr;
39+
static thread_local BumpPtrAllocator ThreadLocalAllocator;
4040
class PerThreadAllocator : public AllocatorBase<PerThreadAllocator> {
4141
public:
4242
inline LLVM_ATTRIBUTE_RETURNS_NONNULL void *Allocate(size_t Size,
4343
size_t Alignment) {
44-
return getAllocatorPtr()->Allocate(Size, Align(Alignment));
44+
return ThreadLocalAllocator.Allocate(Size, Align(Alignment));
4545
}
46-
inline size_t getBytesAllocated() {
47-
return getAllocatorPtr()->getBytesAllocated();
46+
inline size_t getBytesAllocated() const {
47+
return ThreadLocalAllocator.getBytesAllocated();
4848
}
4949

5050
// Pull in base class overloads.
5151
using AllocatorBase<PerThreadAllocator>::Allocate;
52-
53-
protected:
54-
BumpPtrAllocator *getAllocatorPtr() {
55-
if (ThreadLocalAllocator == nullptr)
56-
ThreadLocalAllocator = new BumpPtrAllocator();
57-
58-
return ThreadLocalAllocator;
59-
}
6052
} Allocator;
6153

6254
TEST(ConcurrentHashTableTest, AddStringEntries) {

0 commit comments

Comments
 (0)