[TrailingObjects] Dynamically realign under-aligned trailing objects.
authorJames Y Knight <jyknight@google.com>
Tue, 29 Dec 2015 04:00:43 +0000 (04:00 +0000)
committerJames Y Knight <jyknight@google.com>
Tue, 29 Dec 2015 04:00:43 +0000 (04:00 +0000)
commitd734aaa4ba07f6a56fd5e855d8c152756135e1eb
treee606e79cff6aedaf852f543ea5dd21ad92423ee9
parent992904a0afce8131b6407ad3534a1f3b29838b75
[TrailingObjects] Dynamically realign under-aligned trailing objects.

Previously, the code enforced non-decreasing alignment of each trailing
type. However, it's easy enough to allow for realignment as needed, and
thus avoid the developer having to think about the possiblilities for
alignment requirements on all architectures.

(E.g. on Linux/x86, a struct with an int64 member is 4-byte aligned,
while on other 32-bit archs -- and even with other OSes on x86 -- it has
8-byte alignment. This sort of thing is irritating to have to manually
deal with.)

llvm-svn: 256533
llvm/include/llvm/Support/TrailingObjects.h
llvm/unittests/Support/TrailingObjectsTest.cpp