]> granicus.if.org Git - llvm/commitdiff
[NFC] avoid AlignedCharArray in LLVM
authorJF Bastien <jfbastien@apple.com>
Mon, 29 Jul 2019 23:37:48 +0000 (23:37 +0000)
committerJF Bastien <jfbastien@apple.com>
Mon, 29 Jul 2019 23:37:48 +0000 (23:37 +0000)
As discussed in D65249, don't use AlignedCharArray or std::aligned_storage. Just use alignas(X) char Buf[Size];. This will allow me to remove AlignedCharArray entirely, and works on the current minimum version of Visual Studio.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367277 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/Endian.h
include/llvm/Support/TrailingObjects.h

index d8be94427d7e5533f3cce7aaca2d2ba823f96675..b2249471e64823990ceeb17f1981ea78702f7ce1 100644 (file)
@@ -246,8 +246,10 @@ struct packed_endian_specific_integral {
   }
 
 private:
-  AlignedCharArray<PickAlignment<value_type, alignment>::value,
-                   sizeof(value_type)> Value;
+  struct {
+    alignas(PickAlignment<value_type,
+                          alignment>::value) char buffer[sizeof(value_type)];
+  } Value;
 
 public:
   struct ref {
index 8cf4f7aed7f890886595267a2f8ee642c3f72d8b..8b5daefb7aa53f4638e18f18e784ece0fed49829 100644 (file)
@@ -369,7 +369,9 @@ public:
   template <typename... Tys> struct FixedSizeStorage {
     template <size_t... Counts> struct with_counts {
       enum { Size = totalSizeToAlloc<Tys...>(Counts...) };
-      typedef llvm::AlignedCharArray<alignof(BaseTy), Size> type;
+      struct type {
+        alignas(BaseTy) char buffer[Size];
+      };
     };
   };