diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-06-09 20:58:03 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-06-09 20:58:03 +0000 |
commit | 8ae395de66bec80bfdfb72da8e1217abeec9b913 (patch) | |
tree | 9a83bab611e3806e5458b498a05bdf960d94ebfd /llvm/lib/MC/MCSymbol.cpp | |
parent | c1c3c84bb48ce2a6a4d60469aa81f66cd41e905e (diff) | |
download | bcm5719-llvm-8ae395de66bec80bfdfb72da8e1217abeec9b913.tar.gz bcm5719-llvm-8ae395de66bec80bfdfb72da8e1217abeec9b913.zip |
Use AlignOf traits to enable static_assert.
This is better than runtime asserts. Thanks to David Blaikie for the help here.
llvm-svn: 239431
Diffstat (limited to 'llvm/lib/MC/MCSymbol.cpp')
-rw-r--r-- | llvm/lib/MC/MCSymbol.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCSymbol.cpp b/llvm/lib/MC/MCSymbol.cpp index f0f35f7b29e..836d28294f5 100644 --- a/llvm/lib/MC/MCSymbol.cpp +++ b/llvm/lib/MC/MCSymbol.cpp @@ -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); |