We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ce8ad52 + 403ec1b commit b2a2a76Copy full SHA for b2a2a76
stdlib/public/runtime/StackAllocator.h
@@ -259,7 +259,10 @@ class StackAllocator {
259
StackAllocator() : firstSlab(nullptr), firstSlabIsPreallocated(false) { }
260
261
/// Construct a StackAllocator with a pre-allocated first slab.
262
- StackAllocator(void *firstSlabBuffer, size_t bufferCapacity) {
+ StackAllocator(void *firstSlabBuffer, size_t bufferCapacity) : StackAllocator() {
263
+ // If the pre-allocated buffer can't hold a slab header, ignore it.
264
+ if (bufferCapacity <= Slab::headerSize())
265
+ return;
266
char *start = (char *)llvm::alignAddr(firstSlabBuffer,
267
llvm::Align(alignment));
268
char *end = (char *)firstSlabBuffer + bufferCapacity;
0 commit comments