LLVM  14.0.0git
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
llvm::SmallVectorBase< Size_T > Class Template Reference

This is all the stuff common to all SmallVectors. More...

#include "llvm/ADT/SmallVector.h"

Inheritance diagram for llvm::SmallVectorBase< Size_T >:
Inheritance graph
[legend]
Collaboration diagram for llvm::SmallVectorBase< Size_T >:
Collaboration graph
[legend]

Public Member Functions

size_t size () const
 
size_t capacity () const
 
LLVM_NODISCARD bool empty () const
 
void set_size (size_t N)
 Set the array size to N, which the current array must have enough capacity for. More...
 

Protected Member Functions

 SmallVectorBase ()=delete
 
 SmallVectorBase (void *FirstEl, size_t TotalCapacity)
 
void * mallocForGrow (size_t MinSize, size_t TSize, size_t &NewCapacity)
 This is a helper for grow() that's out of line to reduce code duplication. More...
 
void grow_pod (void *FirstEl, size_t MinSize, size_t TSize)
 This is an implementation of the grow() method which only works on POD-like data types and is out of line to reduce code duplication. More...
 

Static Protected Member Functions

static constexpr size_t SizeTypeMax ()
 The maximum value of the Size_T used. More...
 

Protected Attributes

void * BeginX
 
Size_T Size = 0
 
Size_T Capacity
 

Detailed Description

template<class Size_T>
class llvm::SmallVectorBase< Size_T >

This is all the stuff common to all SmallVectors.

The template parameter specifies the type which should be used to hold the Size and Capacity of the SmallVector, so it can be adjusted. Using 32 bit size is desirable to shrink the size of the SmallVector. Using 64 bit size is desirable for cases like SmallVector<char>, where a 32 bit size would limit the vector to ~4GB. SmallVectors are used for buffering bitcode output - which can exceed 4GB.

Definition at line 45 of file SmallVector.h.

Constructor & Destructor Documentation

◆ SmallVectorBase() [1/2]

template<class Size_T >
llvm::SmallVectorBase< Size_T >::SmallVectorBase ( )
protecteddelete

◆ SmallVectorBase() [2/2]

template<class Size_T >
llvm::SmallVectorBase< Size_T >::SmallVectorBase ( void *  FirstEl,
size_t  TotalCapacity 
)
inlineprotected

Definition at line 56 of file SmallVector.h.

Member Function Documentation

◆ capacity()

template<class Size_T >
size_t llvm::SmallVectorBase< Size_T >::capacity ( ) const
inline

◆ empty()

template<class Size_T >
LLVM_NODISCARD bool llvm::SmallVectorBase< Size_T >::empty ( ) const
inline

Definition at line 73 of file SmallVector.h.

◆ grow_pod()

template<class Size_T >
void SmallVectorBase::grow_pod ( void *  FirstEl,
size_t  MinSize,
size_t  TSize 
)
protected

This is an implementation of the grow() method which only works on POD-like data types and is out of line to reduce code duplication.

This function will report a fatal error if it cannot increase capacity.

Definition at line 120 of file SmallVector.cpp.

◆ mallocForGrow()

template<class Size_T >
void * SmallVectorBase::mallocForGrow ( size_t  MinSize,
size_t  TSize,
size_t &  NewCapacity 
)
protected

This is a helper for grow() that's out of line to reduce code duplication.

This function will report a fatal error if it can't grow at least to MinSize.

Definition at line 112 of file SmallVector.cpp.

◆ set_size()

template<class Size_T >
void llvm::SmallVectorBase< Size_T >::set_size ( size_t  N)
inline

Set the array size to N, which the current array must have enough capacity for.

This does not construct or destroy any elements in the vector.

Clients can use this in conjunction with capacity() to write past the end of the buffer when they know that more elements are available, and only update the size later. This avoids the cost of value initializing elements which will only be overwritten.

Definition at line 84 of file SmallVector.h.

◆ size()

template<class Size_T >
size_t llvm::SmallVectorBase< Size_T >::size ( ) const
inline

Definition at line 70 of file SmallVector.h.

◆ SizeTypeMax()

template<class Size_T >
static constexpr size_t llvm::SmallVectorBase< Size_T >::SizeTypeMax ( )
inlinestaticconstexprprotected

The maximum value of the Size_T used.

Definition at line 51 of file SmallVector.h.

Member Data Documentation

◆ BeginX

template<class Size_T >
void* llvm::SmallVectorBase< Size_T >::BeginX
protected

Definition at line 47 of file SmallVector.h.

◆ Capacity

template<class Size_T >
Size_T llvm::SmallVectorBase< Size_T >::Capacity
protected

◆ Size

template<class Size_T >
Size_T llvm::SmallVectorBase< Size_T >::Size = 0
protected

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