15 #ifndef LLVM_SUPPORT_ALIGNOF_H
16 #define LLVM_SUPPORT_ALIGNOF_H
31 #pragma warning(suppress : 4324)
59 enum { Alignment_GreaterEqual_2Bytes =
Alignment >= 2 ? 1 : 0 };
60 enum { Alignment_GreaterEqual_4Bytes =
Alignment >= 4 ? 1 : 0 };
61 enum { Alignment_GreaterEqual_8Bytes =
Alignment >= 8 ? 1 : 0 };
62 enum { Alignment_GreaterEqual_16Bytes =
Alignment >= 16 ? 1 : 0 };
64 enum { Alignment_LessEqual_2Bytes =
Alignment <= 2 ? 1 : 0 };
65 enum { Alignment_LessEqual_4Bytes =
Alignment <= 4 ? 1 : 0 };
66 enum { Alignment_LessEqual_8Bytes =
Alignment <= 8 ? 1 : 0 };
67 enum { Alignment_LessEqual_16Bytes =
Alignment <= 16 ? 1 : 0 };
94 #if __has_feature(cxx_alignas)
95 template<std::
size_t Alignment, std::
size_t Size>
100 #elif defined(__GNUC__) || defined(__IBM_ATTRIBUTES)
102 template<std::
size_t Alignment, std::
size_t Size>
105 #define LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \
106 template<std::size_t Size> \
107 struct AlignedCharArray<x, Size> { \
108 __attribute__((aligned(x))) char buffer[Size]; \
111 LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(1)
112 LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(2)
113 LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(4)
114 LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(8)
115 LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(16)
116 LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(32)
117 LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(64)
118 LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(128)
120 #undef LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT
123 # error No supported align as directive.
129 template<std::
size_t Alignment, std::
size_t Size>
140 template<std::
size_t Size>
148 template<std::
size_t Size>
156 template<std::
size_t Size>
164 template<std::
size_t Size>
176 #define LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \
177 template<std::size_t Size> \
178 struct AlignedCharArray<x, Size> { \
179 __declspec(align(x)) char buffer[Size]; \
182 LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(16)
183 LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(32)
184 LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(64)
185 LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(128)
187 #undef LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT
192 template <
typename T1,
193 typename T2 = char,
typename T3 = char,
typename T4 = char,
194 typename T5 = char,
typename T6 = char,
typename T7 = char,
195 typename T8 = char,
typename T9 = char,
typename T10 =
char>
197 T1 t1; T2 t2; T3 t3; T4 t4; T5 t5; T6 t6; T7 t7;
T8 t8; T9 t9; T10 t10;
202 template <
typename T1,
203 typename T2 = char,
typename T3 = char,
typename T4 = char,
204 typename T5 = char,
typename T6 = char,
typename T7 = char,
205 typename T8 = char,
typename T9 = char,
typename T10 =
char>
207 char arr1[
sizeof(
T1)], arr2[
sizeof(T2)], arr3[
sizeof(T3)], arr4[
sizeof(T4)],
208 arr5[
sizeof(T5)], arr6[
sizeof(T6)], arr7[
sizeof(T7)], arr8[
sizeof(
T8)],
209 arr9[
sizeof(T9)], arr10[
sizeof(T10)];
220 template <
typename T1,
221 typename T2 = char,
typename T3 = char,
typename T4 = char,
222 typename T5 = char,
typename T6 = char,
typename T7 = char,
223 typename T8 = char,
typename T9 = char,
typename T10 =
char>
225 AlignOf<detail::AlignerImpl<T1, T2, T3, T4, T5,
226 T6, T7, T8, T9, T10> >::Alignment,
227 sizeof(detail::SizerImpl<T1, T2, T3, T4, T5,
228 T6, T7, T8, T9, T10>)> {
AlignOf - A templated class that contains an enum value representing the alignment of the template ar...
Helper for building an aligned character array type.
unsigned alignOf()
alignOf - A templated function that returns the minimum alignment of of a type.
static constexpr unsigned Alignment
This union template exposes a suitably aligned and sized character array member which can hold elemen...