Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit a96fc7a

Browse files
committed
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
1 parent ea8e85d commit a96fc7a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/MC/MCSymbol.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ void *MCSymbol::operator new(size_t s, const StringMapEntry<bool> *Name,
2828
// For safety, ensure that the alignment of a pointer is enough for an
2929
// MCSymbol. This also ensures we don't need padding between the name and
3030
// symbol.
31-
// FIXME: Use static_assert when constexpr is supported.
32-
assert(alignOf<MCSymbol>() <= alignOf<NameEntryStorageTy>() &&
33-
"Bad alignment of MCSymbol");
31+
static_assert(AlignOf<MCSymbol>::Alignment <=
32+
AlignOf<NameEntryStorageTy>::Alignment,
33+
"Bad alignment of MCSymbol");
3434
void *Storage = Ctx.allocate(Size, alignOf<NameEntryStorageTy>());
3535
NameEntryStorageTy *Start = static_cast<NameEntryStorageTy*>(Storage);
3636
NameEntryStorageTy *End = Start + (Name ? 1 : 0);

0 commit comments

Comments
 (0)