Skip to content

Commit 4b5dc15

Browse files
committed
ADT: Change AlignedCharArrayUnion to an alias of std::aligned_union_t, NFC
All the users of `AlignedCharArrayUnion` were changed in 5b267fb to stop peeking inside (to look at `buffer`), so this finishes gutting it. It's now an alias of `std::aligned_union_t`, with a minor difference in template parameters (`std::aligned_union_t` takes a minimum size and 0+ types, whereas this just takes 1+ types... maybe a bit simpler to use correctly?). A follow up will remove `AlignedCharArrayUnion` entirely, inlining this alias into its users. Differential Revision: https://reviews.llvm.org/D92512
1 parent 5baef63 commit 4b5dc15

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

llvm/include/llvm/Support/AlignOf.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@ namespace llvm {
2020
/// A suitably aligned and sized character array member which can hold elements
2121
/// of any type.
2222
///
23-
/// These types may be arrays, structs, or any other types. This exposes a
24-
/// `buffer` member which can be used as suitable storage for a placement new of
25-
/// any of these types.
26-
template <typename T, typename... Ts> struct AlignedCharArrayUnion {
27-
using AlignedUnion = std::aligned_union_t<1, T, Ts...>;
28-
alignas(alignof(AlignedUnion)) char buffer[sizeof(AlignedUnion)];
29-
};
23+
/// These types may be arrays, structs, or any other types. Underneath is a
24+
/// char buffer member which can be used as suitable storage for a placement
25+
/// new of any of these types.
26+
template <typename T, typename... Ts>
27+
using AlignedCharArrayUnion = std::aligned_union_t<1, T, Ts...>;
3028

3129
} // end namespace llvm
3230

0 commit comments

Comments
 (0)