[llvm] r367277 - [NFC] avoid AlignedCharArray in LLVM

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 16:37:48 PDT 2019


Author: jfb
Date: Mon Jul 29 16:37:48 2019
New Revision: 367277

URL: http://llvm.org/viewvc/llvm-project?rev=367277&view=rev
Log:
[NFC] avoid AlignedCharArray in LLVM

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.

Modified:
    llvm/trunk/include/llvm/Support/Endian.h
    llvm/trunk/include/llvm/Support/TrailingObjects.h

Modified: llvm/trunk/include/llvm/Support/Endian.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Endian.h?rev=367277&r1=367276&r2=367277&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Endian.h (original)
+++ llvm/trunk/include/llvm/Support/Endian.h Mon Jul 29 16:37:48 2019
@@ -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 {

Modified: llvm/trunk/include/llvm/Support/TrailingObjects.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TrailingObjects.h?rev=367277&r1=367276&r2=367277&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/TrailingObjects.h (original)
+++ llvm/trunk/include/llvm/Support/TrailingObjects.h Mon Jul 29 16:37:48 2019
@@ -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];
+      };
     };
   };
 




More information about the llvm-commits mailing list