LLVM 20.0.0git
|
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/MemAlloc.h"
#include <cstdint>
Go to the source code of this file.
Functions | |
static void | report_size_overflow (size_t MinSize, size_t MaxSize) |
Report that MinSize doesn't fit into this vector's size type. | |
static void | report_at_maximum_capacity (size_t MaxSize) |
Report that this vector is already at maximum capacity. | |
template<class Size_T > | |
static size_t | getNewCapacity (size_t MinSize, size_t TSize, size_t OldCapacity) |
static void * | replaceAllocation (void *NewElts, size_t TSize, size_t NewCapacity, size_t VSize=0) |
If vector was first created with capacity 0, getFirstEl() points to the memory right after, an area unallocated. | |
|
static |
Definition at line 90 of file SmallVector.cpp.
References report_at_maximum_capacity(), and report_size_overflow().
|
static |
If vector was first created with capacity 0, getFirstEl() points to the memory right after, an area unallocated.
If a subsequent allocation, that grows the vector, happens to return the same pointer as getFirstEl(), get a new allocation, otherwise isSmall() will falsely return that no allocation was done (true) and the memory will not be freed in the destructor. If a VSize is given (vector size), also copy that many elements to the new allocation - used if realloca fails to increase space, and happens to allocate precisely at BeginX. This is unlikely to be called often, but resolves a memory leak when the situation does occur.
Definition at line 121 of file SmallVector.cpp.
References llvm::safe_malloc().
Referenced by llvm::SmallVectorBase< Size_T >::grow_pod(), and llvm::SmallVectorBase< Size_T >::mallocForGrow().
|
static |
Report that this vector is already at maximum capacity.
Throws std::length_error or calls report_fatal_error.
Definition at line 77 of file SmallVector.cpp.
References llvm::report_fatal_error().
Referenced by getNewCapacity().
|
static |
Report that MinSize doesn't fit into this vector's size type.
Throws std::length_error or calls report_fatal_error.
Definition at line 62 of file SmallVector.cpp.
Referenced by getNewCapacity().