From: Duncan P. N. Exon Smith Date: Fri, 4 Dec 2020 02:37:59 +0000 (-0800) Subject: ADT: Change AlignedCharArrayUnion to an alias of std::aligned_union_t, NFC X-Git-Tag: llvmorg-13-init~4337 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b5dc150b9862271720b3d56a3e723a55dd81838;p=platform%2Fupstream%2Fllvm.git 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 --- 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