File tree 1 file changed +4
-12
lines changed 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -36,27 +36,19 @@ class String {
36
36
std::array<char , 0x20 > ExtraData;
37
37
};
38
38
39
- static LLVM_THREAD_LOCAL BumpPtrAllocator * ThreadLocalAllocator = nullptr ;
39
+ static thread_local BumpPtrAllocator ThreadLocalAllocator;
40
40
class PerThreadAllocator : public AllocatorBase <PerThreadAllocator> {
41
41
public:
42
42
inline LLVM_ATTRIBUTE_RETURNS_NONNULL void *Allocate (size_t Size ,
43
43
size_t Alignment) {
44
- return getAllocatorPtr ()-> Allocate (Size , Align (Alignment));
44
+ return ThreadLocalAllocator. Allocate (Size , Align (Alignment));
45
45
}
46
- inline size_t getBytesAllocated () {
47
- return getAllocatorPtr ()-> getBytesAllocated ();
46
+ inline size_t getBytesAllocated () const {
47
+ return ThreadLocalAllocator. getBytesAllocated ();
48
48
}
49
49
50
50
// Pull in base class overloads.
51
51
using AllocatorBase<PerThreadAllocator>::Allocate;
52
-
53
- protected:
54
- BumpPtrAllocator *getAllocatorPtr () {
55
- if (ThreadLocalAllocator == nullptr )
56
- ThreadLocalAllocator = new BumpPtrAllocator ();
57
-
58
- return ThreadLocalAllocator;
59
- }
60
52
} Allocator;
61
53
62
54
TEST (ConcurrentHashTableTest, AddStringEntries) {
You can’t perform that action at this time.
0 commit comments