llvm::SmallVectorImpl

Shared SmallVector API and growth logic independent of inline capacity.

Synopsis

Declared in <llvm/ADT/SmallVector.h>

template<typename T>
class SmallVectorImpl
    : public SmallVectorTemplateBase<T>

Description

This class consists of common code factored out of the SmallVector class to reduce code duplication based on the SmallVector 'N' template parameter.

Base Classes

NameDescription
SmallVectorTemplateBase<T>SmallVectorTemplateBase<TriviallyCopyable = false> - This is where we put method implementations that are designed to work with non-trivial T's.

Type Aliases

NameDescription
const_iterator Const iterator over the vector elements.
const_pointer Const pointer to an element.
const_reference Const reference to an element.
const_reverse_iterator Const reverse iterator over the vector elements.
difference_type Signed type used to express the distance between iterators.
iterator Mutable iterator over the vector elements.
pointer Mutable pointer to an element.
reference Mutable reference to an element.
reverse_iterator Reverse iterator over the vector elements.
size_type Unsigned type used to express the size of the vector.
value_type Element type stored in the vector.

Member Functions

NameDescription
SmallVectorImpl [constructor] [deleted]Copy construction is not allowed.
operator= Assignment operators
append append overloads
assign assign overloads
back back overloads
begin Return an iterator to the first element.
capacity Return the number of elements the vector can hold without reallocating.
capacity_in_bytes Return the number of bytes of allocated storage.
clear Remove all elements from the vector.
data Return a pointer to the vector's buffer, even if empty().
emplace_back Construct an element in place at the end using Args.
empty Return true if the vector contains no elements.
end Return an iterator past the last element.
erase erase overloads
front front overloads
insert insert overloads
max_size Return the maximum number of elements the vector can hold.
operator[] Subscript operators
pop_back Destroy and remove the last element of the vector.
pop_back_n Remove the last NumItems elements from the vector.
pop_back_val Remove and return the last element by move.
push_back push_back overloads
rbegin rbegin overloads
rend rend overloads
reserve Ensure capacity for at least N elements.
resize resize overloads
resize_for_overwrite Like resize, but new elements are default-initialized without value construction when T is POD-like.
size Return the number of elements in the vector.
size_in_bytes Return the number of bytes used by the current elements.
swap Exchange the contents of this vector with RHS.
truncate Like resize, but requires that N is less than size().
operator== Return true if this vector and RHS have equal elements.
operator!= Return true if this vector and RHS differ.
operator< Lexicographically compare this vector with RHS.
operator<= Lexicographically compare this vector with RHS for less-or-equal.
operator> Lexicographically compare this vector with RHS for greater-than.
operator>= Lexicographically compare this vector with RHS for greater-or-equal.

Using Declarations

NameDescription
capacity Inherit capacity() from SmallVectorBase.
empty Inherit empty() from SmallVectorBase.
size Inherit size() from SmallVectorBase.

Protected Type Aliases

NameDescription
ValueParamT Parameter type used when passing elements to mutating operations.

Protected Member Functions

NameDescription
SmallVectorImpl [constructor]Construct an empty SmallVectorImpl with inline capacity N.
~SmallVectorImpl [destructor]Destroy storage if the vector grew beyond the inline buffer.
assertSafeToAdd Check whether Elt will be invalidated by increasing the size of the vector by N.
assertSafeToAddRange Check whether any part of the range will be invalidated by growing.
assertSafeToReferenceAfterClear Check whether any part of the range will be invalidated by clearing.
assertSafeToReferenceAfterResize Check whether Elt will be invalidated by resizing the vector to NewSize.
assignRemote Take ownership of RHS's heap allocation, leaving RHS empty and small.
getFirstEl Return a pointer to the first element of inline storage.
grow Grow the allocated memory without initializing new elements.
growAndAssign Grow storage and replace contents with NumElts copies of Elt.
growAndEmplaceBack Grow storage and emplace an element at the end using Args.
grow_pod grow_pod overloads
isRangeInStorage Return true if First and Last form a valid (possibly empty) range in this vector's storage.
isReferenceToRange Return true if V is an internal reference to the given range.
isReferenceToStorage Return true if V is an internal reference to this vector.
isSafeToReferenceAfterResize Return true unless Elt will be invalidated by resizing the vector to NewSize.
isSmall Return true if this is a smallvector which has not had dynamic memory allocated for it.
mallocForGrow mallocForGrow overloads
moveElementsForGrow Move existing elements over to the new allocation NewElts, the middle section of grow().
reserveForParamAndGetAddress Reserve enough space to add one element, and return the updated element pointer in case it was a reference to the storage.
resetToSmall Put this vector in a state of being small.
set_allocation_range Set the array data pointer to Begin and capacity to N.
set_size Set the array size to N, which the current array must have enough capacity for.
takeAllocationForGrow Transfer ownership of the allocation, finishing up grow().

Protected Static Member Functions

NameDescription
SizeTypeMax The maximum value of the Size_T used.
destroy_range Destroy the elements in the range []S, E).
forward_value_param forward_value_param overloads
reserveForParamAndGetAddressImpl Reserve enough space to add one element, and return the updated element pointer in case it was a reference to the storage.
uninitialized_copy Copy the range []I, E) onto uninitialized memory starting at Dest.
uninitialized_move Move the range []I, E) into uninitialized memory starting at Dest.

Protected Data Members

NameDescription
BeginX Pointer to the first element, or inline storage.
Capacity Number of elements the current storage can hold without reallocating.
Size Number of constructed elements currently stored.

Protected Static Data Members

NameDescription
TakesParamByValue False when elements are passed by const reference rather than by value.

Protected Using Declarations

NameDescription
TakesParamByValue Whether element parameters are passed by value rather than by const reference.

Non-Member Functions

NameDescription
ComputeASanStackFrameDescriptionCompute a frame description string for AddressSanitizer reports.
ComputeASanStackFrameLayoutCompute the AddressSanitizer layout of a stack frame.
GetShadowBytesReturn shadow bytes for a stack frame with all locals in scope.
GetShadowBytesAfterScopeReturn shadow bytes after all locals have gone out of scope.
RecursivelyDeleteTriviallyDeadInstructionsRecursively delete a worklist of trivially dead instructions.
RecursivelyDeleteTriviallyDeadInstructionsPermissiveRecursively delete trivially dead instructions from a permissive worklist.
appendLEB128Append a LEB128-encoded value to a byte buffer.
filterDeadComdatFunctionsFilter out potentially dead comdat functions where other entries keep the entire comdat group alive.
findDevirtualizableCallsForTypeCheckedLoadGiven a call to the intrinsic @llvm.type.checked.load, find all devirtualizable call sites based on the call and return them in DevirtCalls.
findDevirtualizableCallsForTypeTestGiven a call to the intrinsic @llvm.type.test, find all devirtualizable call sites based on the call and return them in DevirtCalls.
formLCSSAForInstructionsEnsures LCSSA form for every instruction from the Worklist in the scope of innermost containing loop.
get_thread_nameGet the name of the current thread.
isManyPotentiallyReachableFromManyDetermine whether any block in Worklist can reach any block in StopSet.
isPotentiallyReachableFromManyDetermine whether any block in Worklist can reach StopBB.
operator!=Return true if SmallVector LHS differs from ArrayRef RHS.
operator==Return true if SmallVector LHS equals ArrayRef RHS.
AArch64::fillValidCPUArchListAppend all valid CPU and architecture names to Values.
AMDGPU::fillValidArchListAMDGCNAppend the valid AMDGCN GPU names to Values.
AMDGPU::fillValidArchListR600Append the valid R600 GPU names to Values.
ARM::fillValidCPUArchListAppend every valid ARM CPU name to Values.
CSKY::fillValidCPUArchListAppend every valid CSKY CPU name to Values.
LoongArch::fillValidCPUListAppend every valid LoongArch CPU name to Values.
MachO::replace_extensionReplace extension considering frameworks.
PPC::fillValidCPUListAppend every valid PowerPC CPU name to Values.
PPC::fillValidTuneCPUListAppend every valid PowerPC tune CPU name to Values.
RISCV::fillValidCPUArchListAppend every valid RISC-V CPU name for the given bitness to Values.
RISCV::fillValidTuneCPUArchListAppend every valid RISC-V tune CPU name for the given bitness to Values.
RISCV::getAllTuneFeaturesAppend every recognized RISC-V tune-feature name to TuneFeatures.
SwitchCG::getJumpTableNumCasesReturn the number of cases within a range.
X86::fillValidCPUArchListProvide a list of valid CPU names. If Only64Bit is true, the list will only contain 64-bit capable CPUs.
X86::fillValidTuneCPUListProvide a list of valid -mtune names.
Xtensa::fillValidCPUListAppend every valid Xtensa CPU name (and aliases) to Values.
omp::getBestVariantMatchForContextReturn the index (into VMIs) of the variant with the highest score from the ones applicable in Ctx. See llvm::isVariantApplicableInContext.
yaml::yaml2ObjectFileConvenience function for tests.
support::endian::writeAppend V to Out using the given byte order.
sys::fs::current_pathGet the current path.
sys::fs::make_absoluteMake path an absolute path.
sys::path::appendAppend path components using path style separators.
sys::path::appendAppend to path.
sys::path::appendAppend to path.
sys::path::cache_directoryGet the directory where installed packages should put their machine-local cache, e.g. $XDG_CACHE_HOME.
sys::path::home_directoryGet the user's home directory.
sys::path::make_preferredFor Windows path styles, convert path to use the preferred path separators. For other styles, do nothing.
sys::path::nativeConvert path to the native form in place.
sys::path::remove_dotsRemove './' and optionally '../' components, and canonicalize separators.
sys::path::remove_filenameRemove the last component from path unless it is the root dir.
sys::path::replace_extensionReplace the file extension of path with extension.
sys::path::replace_path_prefixReplace matching path prefix with another path.
sys::path::user_config_directoryGet the directory where packages should read user-specific configurations. e.g. $XDG_CONFIG_HOME.

Derived Classes

NameDescription
SmallVector Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference sizeof(SmallVector<T, 0>).

Template Parameters

NameDescription
TElement type stored in the vector.