From 4b5dc150b9862271720b3d56a3e723a55dd81838 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Thu, 3 Dec 2020 18:37:59 -0800 Subject: [PATCH] ADT: Change AlignedCharArrayUnion to an alias of std::aligned_union_t, NFC All the users of `AlignedCharArrayUnion` were changed in 5b267fb7966157e0d79ea85cbc1d07f92f840d3c 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 --- llvm/include/llvm/Support/AlignOf.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/llvm/include/llvm/Support/AlignOf.h b/llvm/include/llvm/Support/AlignOf.h index f9dcde4..2b293ca 100644 --- a/llvm/include/llvm/Support/AlignOf.h +++ b/llvm/include/llvm/Support/AlignOf.h @@ -20,13 +20,11 @@ namespace llvm { /// A suitably aligned and sized character array member which can hold elements /// of any type. /// -/// These types may be arrays, structs, or any other types. This exposes a -/// `buffer` member which can be used as suitable storage for a placement new of -/// any of these types. -template struct AlignedCharArrayUnion { - using AlignedUnion = std::aligned_union_t<1, T, Ts...>; - alignas(alignof(AlignedUnion)) char buffer[sizeof(AlignedUnion)]; -}; +/// These types may be arrays, structs, or any other types. Underneath is a +/// char buffer member which can be used as suitable storage for a placement +/// new of any of these types. +template +using AlignedCharArrayUnion = std::aligned_union_t<1, T, Ts...>; } // end namespace llvm -- 2.7.4