[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)
commitb905a6b1c4aca04d3ecd7ae1776af58364b10bcb
treeba2b6d413cd45923feb306b2eeb3cf2caecb76ae
parentc1b271062b7b1b4b51500a1f744a23223197fac6
[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.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256533 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/TrailingObjects.h
unittests/Support/TrailingObjectsTest.cpp