Author: Duncan P. N. Exon Smith Date: 2020-12-04T11:59:35-08:00 New Revision: 4b5dc150b9862271720b3d56a3e723a55dd81838
URL: https://github.com/llvm/llvm-project/commit/4b5dc150b9862271720b3d56a3e723a55dd81838 DIFF: https://github.com/llvm/llvm-project/commit/4b5dc150b9862271720b3d56a3e723a55dd81838.diff LOG: 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 Added: Modified: llvm/include/llvm/Support/AlignOf.h Removed: ################################################################################ diff --git a/llvm/include/llvm/Support/AlignOf.h b/llvm/include/llvm/Support/AlignOf.h index f9dcde4d4ff1..2b293cae6542 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 <typename T, typename... Ts> 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 <typename T, typename... Ts> +using AlignedCharArrayUnion = std::aligned_union_t<1, T, Ts...>; } // end namespace llvm _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits