mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-23 20:29:30 +00:00
Use AlignOf traits to enable static_assert.
This is better than runtime asserts. Thanks to David Blaikie for the help here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239431 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ea8e85d925
commit
a96fc7ab00
@ -28,9 +28,9 @@ void *MCSymbol::operator new(size_t s, const StringMapEntry<bool> *Name,
|
||||
// For safety, ensure that the alignment of a pointer is enough for an
|
||||
// MCSymbol. This also ensures we don't need padding between the name and
|
||||
// symbol.
|
||||
// FIXME: Use static_assert when constexpr is supported.
|
||||
assert(alignOf<MCSymbol>() <= alignOf<NameEntryStorageTy>() &&
|
||||
"Bad alignment of MCSymbol");
|
||||
static_assert(AlignOf<MCSymbol>::Alignment <=
|
||||
AlignOf<NameEntryStorageTy>::Alignment,
|
||||
"Bad alignment of MCSymbol");
|
||||
void *Storage = Ctx.allocate(Size, alignOf<NameEntryStorageTy>());
|
||||
NameEntryStorageTy *Start = static_cast<NameEntryStorageTy*>(Storage);
|
||||
NameEntryStorageTy *End = Start + (Name ? 1 : 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user