Skip to content

Commit cd8da12

Browse files
authored
Merge pull request #40244 from mikeash/max-align-window-fix
[Runtime] Replace std::max_align_t with MaximumAlignment from MetadataValues.h.
2 parents bf83d81 + 89d93a0 commit cd8da12

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

include/swift/Reflection/ReflectionContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ class ReflectionContext
13721372
// For now, we won't try to walk the allocations in the slab, we'll just
13731373
// provide the whole thing as one big chunk.
13741374
size_t HeaderSize =
1375-
llvm::alignTo(sizeof(*Slab), llvm::Align(alignof(std::max_align_t)));
1375+
llvm::alignTo(sizeof(*Slab), llvm::Align(MaximumAlignment));
13761376
AsyncTaskAllocationChunk Chunk;
13771377

13781378
Chunk.Start = SlabPtr + HeaderSize;

stdlib/public/runtime/Casting.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151

5252
#if defined(__GLIBCXX__) && __GLIBCXX__ < 20160726
5353
#include <stddef.h>
54-
namespace std { using ::max_align_t; }
5554
#endif
5655

5756
using namespace swift;

stdlib/public/runtime/DynamicCast.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ _tryCastFromClassToObjCBridgeable(
274274

275275
// The extra byte is for the tag on the T?
276276
const std::size_t inlineValueSize = 3 * sizeof(void*);
277-
alignas(std::max_align_t) char inlineBuffer[inlineValueSize + 1];
277+
alignas(MaximumAlignment) char inlineBuffer[inlineValueSize + 1];
278278
void *optDestBuffer;
279279
if (destType->getValueWitnesses()->getStride() <= inlineValueSize) {
280280
// Use the inline buffer.

stdlib/public/runtime/StackAllocator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616

17+
#include "swift/ABI/MetadataValues.h"
1718
#include "swift/Runtime/Debug.h"
1819
#include "llvm/Support/Alignment.h"
1920
#include <cstddef>
@@ -67,7 +68,7 @@ class StackAllocator {
6768
bool firstSlabIsPreallocated;
6869

6970
/// The minimal alignment of allocated memory.
70-
static constexpr size_t alignment = alignof(std::max_align_t);
71+
static constexpr size_t alignment = MaximumAlignment;
7172

7273
/// If set to true, memory allocations are checked for buffer overflows and
7374
/// use-after-free, similar to guard-malloc.

0 commit comments

Comments
 (0)