LLVM 20.0.0git
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize > Class Template Reference

This class is a simple list of T structures. More...

#include "DWARFLinker/Parallel/ArrayList.h"

Inheritance diagram for llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >:
Inheritance graph
[legend]

Classes

struct  ItemsGroup
 

Public Types

using ItemHandlerTy = function_ref< void(T &)>
 

Public Member Functions

 ArrayList (llvm::parallel::PerThreadBumpPtrAllocator *Allocator)
 
Tadd (const T &Item)
 Add specified Item to the list.
 
void forEach (ItemHandlerTy Handler)
 Enumerate all items and apply specified Handler to each.
 
bool empty ()
 Check whether list is empty.
 
void erase ()
 Erase list.
 
void sort (function_ref< bool(const T &LHS, const T &RHS)> Comparator)
 
size_t size ()
 

Protected Member Functions

bool allocateNewGroup (std::atomic< ItemsGroup * > &AtomicGroup)
 

Protected Attributes

std::atomic< ItemsGroup * > GroupsHead = nullptr
 
std::atomic< ItemsGroup * > LastGroup = nullptr
 
llvm::parallel::PerThreadBumpPtrAllocatorAllocator = nullptr
 

Detailed Description

template<typename T, size_t ItemsGroupSize = 512>
class llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >

This class is a simple list of T structures.

It keeps elements as pre-allocated groups to save memory for each element's next pointer. It allocates internal data using specified per-thread BumpPtrAllocator. Method add() can be called asynchronously.

Definition at line 23 of file ArrayList.h.

Member Typedef Documentation

◆ ItemHandlerTy

template<typename T , size_t ItemsGroupSize = 512>
using llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::ItemHandlerTy = function_ref<void(T &)>

Definition at line 60 of file ArrayList.h.

Constructor & Destructor Documentation

◆ ArrayList()

template<typename T , size_t ItemsGroupSize = 512>
llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::ArrayList ( llvm::parallel::PerThreadBumpPtrAllocator Allocator)
inline

Definition at line 25 of file ArrayList.h.

Member Function Documentation

◆ add()

template<typename T , size_t ItemsGroupSize = 512>
T & llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::add ( const T Item)
inline

◆ allocateNewGroup()

template<typename T , size_t ItemsGroupSize = 512>
bool llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::allocateNewGroup ( std::atomic< ItemsGroup * > &  AtomicGroup)
inlineprotected

◆ empty()

template<typename T , size_t ItemsGroupSize = 512>
bool llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::empty ( )
inline

Check whether list is empty.

Definition at line 72 of file ArrayList.h.

References llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::GroupsHead.

◆ erase()

template<typename T , size_t ItemsGroupSize = 512>
void llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::erase ( )
inline

◆ forEach()

template<typename T , size_t ItemsGroupSize = 512>
void llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::forEach ( ItemHandlerTy  Handler)
inline

◆ size()

template<typename T , size_t ItemsGroupSize = 512>
size_t llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::size ( )
inline

◆ sort()

template<typename T , size_t ItemsGroupSize = 512>
void llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::sort ( function_ref< bool(const T &LHS, const T &RHS)>  Comparator)
inline

Member Data Documentation

◆ Allocator

template<typename T , size_t ItemsGroupSize = 512>
llvm::parallel::PerThreadBumpPtrAllocator* llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::Allocator = nullptr
protected

◆ GroupsHead

template<typename T , size_t ItemsGroupSize = 512>
std::atomic<ItemsGroup *> llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::GroupsHead = nullptr
protected

◆ LastGroup

template<typename T , size_t ItemsGroupSize = 512>
std::atomic<ItemsGroup *> llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::LastGroup = nullptr
protected

The documentation for this class was generated from the following file: