[compiler-rt] 337a200 - [NFC] [scudo] Move static_assert to class it concerns (#84245)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 11:49:16 PDT 2024


Author: Florian Mayer
Date: 2024-03-11T11:47:59-07:00
New Revision: 337a20071518d647a0d453f93055817131aa15e9

URL: https://github.com/llvm/llvm-project/commit/337a20071518d647a0d453f93055817131aa15e9
DIFF: https://github.com/llvm/llvm-project/commit/337a20071518d647a0d453f93055817131aa15e9.diff

LOG: [NFC] [scudo] Move static_assert to class it concerns (#84245)

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/combined.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h
index 4dacfac707926d..9e1fd6d6dca3c6 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -1081,6 +1081,11 @@ class Allocator {
     // An array of Size (at least one) elements of type Entry is immediately
     // following to this struct.
   };
+  static_assert(sizeof(AllocationRingBuffer) %
+                        alignof(typename AllocationRingBuffer::Entry) ==
+                    0,
+                "invalid alignment");
+
   // Pointer to memory mapped area starting with AllocationRingBuffer struct,
   // and immediately followed by Size elements of type Entry.
   atomic_uptr RingBufferAddress = {};
@@ -1585,10 +1590,6 @@ class Allocator {
 
     atomic_store(&RingBufferAddress, reinterpret_cast<uptr>(RB),
                  memory_order_release);
-    static_assert(sizeof(AllocationRingBuffer) %
-                          alignof(typename AllocationRingBuffer::Entry) ==
-                      0,
-                  "invalid alignment");
   }
 
   void unmapRingBuffer() {


        


More information about the llvm-commits mailing list