Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sanitizer] Replace ALIGNED with alignas #98958

Merged

Conversation

MaskRay
Copy link
Member

@MaskRay MaskRay commented Jul 15, 2024

C++11 alignas is already used extensively. alignas must precede
static, so adjust the ordering accordingly.

msan.cpp: Clang 15 doesn't allow __attribute__((visibility("default"))) alignas(16).
Use the order alignas(16) SANITIZER_INTERFACE_ATTRIBUTE. Tested with Clang 7.

Created using spr 1.3.5-bogner
@MaskRay MaskRay requested a review from vitalybuka July 15, 2024 20:37
@llvmbot llvmbot added compiler-rt compiler-rt:asan Address sanitizer compiler-rt:ubsan Undefined behavior sanitizer compiler-rt:hwasan Hardware-assisted address sanitizer PGO Profile Guided Optimizations compiler-rt:msan Memory sanitizer compiler-rt:lsan Leak sanitizer compiler-rt:sanitizer labels Jul 15, 2024
@MaskRay MaskRay requested a review from thurstond July 15, 2024 20:37
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 15, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Fangrui Song (MaskRay)

Changes

C++11 alignas is already used extensively. alignas must precede
static, so adjust the ordering accordingly.

msan.cpp: Clang 15 doesn't allow __attribute__((visibility("default"))) alignas(16).
Use the order alignas(16) SANITIZER_INTERFACE_ATTRIBUTE. Tested with Clang 7.


Full diff: https://github.com/llvm/llvm-project/pull/98958.diff

20 Files Affected:

  • (modified) compiler-rt/lib/asan/asan_globals_win.cpp (+4-4)
  • (modified) compiler-rt/lib/asan/asan_malloc_linux.cpp (+2-2)
  • (modified) compiler-rt/lib/asan/asan_report.cpp (+2-2)
  • (modified) compiler-rt/lib/asan/asan_suppressions.cpp (+1-1)
  • (modified) compiler-rt/lib/asan/asan_thread.cpp (+4-4)
  • (modified) compiler-rt/lib/dfsan/dfsan_allocator.h (+1-1)
  • (modified) compiler-rt/lib/hwasan/hwasan_allocator.cpp (+1-1)
  • (modified) compiler-rt/lib/hwasan/hwasan_thread_list.cpp (+4-4)
  • (modified) compiler-rt/lib/lsan/lsan_common.cpp (+1-1)
  • (modified) compiler-rt/lib/lsan/lsan_common_linux.cpp (+1-1)
  • (modified) compiler-rt/lib/lsan/lsan_thread.cpp (+3-3)
  • (modified) compiler-rt/lib/memprof/memprof_thread.cpp (+1-1)
  • (modified) compiler-rt/lib/msan/msan.cpp (+4-5)
  • (modified) compiler-rt/lib/msan/msan_allocator.h (+1-1)
  • (modified) compiler-rt/lib/msan/msan_interceptors.cpp (+1-1)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp (+1-1)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h (+1-1)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h (+1-1)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_atomic.h (+1-1)
  • (modified) compiler-rt/lib/ubsan/ubsan_diag.cpp (+1-1)
diff --git a/compiler-rt/lib/asan/asan_globals_win.cpp b/compiler-rt/lib/asan/asan_globals_win.cpp
index 19af88ab12b40..9442cc35d5ab7 100644
--- a/compiler-rt/lib/asan/asan_globals_win.cpp
+++ b/compiler-rt/lib/asan/asan_globals_win.cpp
@@ -17,10 +17,10 @@ namespace __asan {
 
 #pragma section(".ASAN$GA", read, write)
 #pragma section(".ASAN$GZ", read, write)
-extern "C" __declspec(allocate(".ASAN$GA"))
-    ALIGNED(sizeof(__asan_global)) __asan_global __asan_globals_start = {};
-extern "C" __declspec(allocate(".ASAN$GZ"))
-    ALIGNED(sizeof(__asan_global)) __asan_global __asan_globals_end = {};
+extern "C" alignas(sizeof(__asan_global))
+    __declspec(allocate(".ASAN$GA")) __asan_global __asan_globals_start = {};
+extern "C" alignas(sizeof(__asan_global))
+    __declspec(allocate(".ASAN$GZ")) __asan_global __asan_globals_end = {};
 #pragma comment(linker, "/merge:.ASAN=.data")
 
 static void call_on_globals(void (*hook)(__asan_global *, uptr)) {
diff --git a/compiler-rt/lib/asan/asan_malloc_linux.cpp b/compiler-rt/lib/asan/asan_malloc_linux.cpp
index d426b923c94ed..08a63045c4e65 100644
--- a/compiler-rt/lib/asan/asan_malloc_linux.cpp
+++ b/compiler-rt/lib/asan/asan_malloc_linux.cpp
@@ -185,11 +185,11 @@ struct MallocDebugL {
   void* (*valloc)(uptr size);
 };
 
-ALIGNED(32) const MallocDebugK asan_malloc_dispatch_k = {
+alignas(32) const MallocDebugK asan_malloc_dispatch_k = {
     WRAP(malloc),  WRAP(free),     WRAP(calloc),
     WRAP(realloc), WRAP(memalign), WRAP(malloc_usable_size)};
 
-ALIGNED(32) const MallocDebugL asan_malloc_dispatch_l = {
+alignas(32) const MallocDebugL asan_malloc_dispatch_l = {
     WRAP(calloc),         WRAP(free),               WRAP(mallinfo),
     WRAP(malloc),         WRAP(malloc_usable_size), WRAP(memalign),
     WRAP(posix_memalign), WRAP(pvalloc),            WRAP(realloc),
diff --git a/compiler-rt/lib/asan/asan_report.cpp b/compiler-rt/lib/asan/asan_report.cpp
index c9730dd368cb4..fd590e401f67f 100644
--- a/compiler-rt/lib/asan/asan_report.cpp
+++ b/compiler-rt/lib/asan/asan_report.cpp
@@ -34,8 +34,8 @@ namespace __asan {
 // -------------------- User-specified callbacks ----------------- {{{1
 static void (*error_report_callback)(const char*);
 using ErrorMessageBuffer = InternalMmapVectorNoCtor<char, true>;
-static ALIGNED(
-    alignof(ErrorMessageBuffer)) char error_message_buffer_placeholder
+alignas(
+    alignof(ErrorMessageBuffer)) static char error_message_buffer_placeholder
     [sizeof(ErrorMessageBuffer)];
 static ErrorMessageBuffer *error_message_buffer = nullptr;
 static Mutex error_message_buf_mutex;
diff --git a/compiler-rt/lib/asan/asan_suppressions.cpp b/compiler-rt/lib/asan/asan_suppressions.cpp
index 6cee674960395..94289d14d7e78 100644
--- a/compiler-rt/lib/asan/asan_suppressions.cpp
+++ b/compiler-rt/lib/asan/asan_suppressions.cpp
@@ -20,7 +20,7 @@
 
 namespace __asan {
 
-ALIGNED(64) static char suppression_placeholder[sizeof(SuppressionContext)];
+alignas(64) static char suppression_placeholder[sizeof(SuppressionContext)];
 static SuppressionContext *suppression_ctx = nullptr;
 static const char kInterceptorName[] = "interceptor_name";
 static const char kInterceptorViaFunction[] = "interceptor_via_fun";
diff --git a/compiler-rt/lib/asan/asan_thread.cpp b/compiler-rt/lib/asan/asan_thread.cpp
index 480a423952e8f..c79c33ab01342 100644
--- a/compiler-rt/lib/asan/asan_thread.cpp
+++ b/compiler-rt/lib/asan/asan_thread.cpp
@@ -67,10 +67,10 @@ static void InitThreads() {
   // thread before all TSD destructors will be called for it.
 
   // MIPS requires aligned address
-  static ALIGNED(alignof(
-      ThreadRegistry)) char thread_registry_placeholder[sizeof(ThreadRegistry)];
-  static ALIGNED(alignof(
-      ThreadArgRetval)) char thread_data_placeholder[sizeof(ThreadArgRetval)];
+  alignas(alignof(ThreadRegistry)) static char
+      thread_registry_placeholder[sizeof(ThreadRegistry)];
+  alignas(alignof(ThreadArgRetval)) static char
+      thread_data_placeholder[sizeof(ThreadArgRetval)];
 
   asan_thread_registry =
       new (thread_registry_placeholder) ThreadRegistry(GetAsanThreadContext);
diff --git a/compiler-rt/lib/dfsan/dfsan_allocator.h b/compiler-rt/lib/dfsan/dfsan_allocator.h
index 3b4171b6314d6..6ff24fc57a855 100644
--- a/compiler-rt/lib/dfsan/dfsan_allocator.h
+++ b/compiler-rt/lib/dfsan/dfsan_allocator.h
@@ -18,7 +18,7 @@
 namespace __dfsan {
 
 struct DFsanThreadLocalMallocStorage {
-  ALIGNED(8) uptr allocator_cache[96 * (512 * 8 + 16)];  // Opaque.
+  alignas(8) uptr allocator_cache[96 * (512 * 8 + 16)];  // Opaque.
   void CommitBack();
 
  private:
diff --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
index 7771127731de8..75dbb336e3445 100644
--- a/compiler-rt/lib/hwasan/hwasan_allocator.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
@@ -44,7 +44,7 @@ enum {
 
 
 // Initialized in HwasanAllocatorInit, an never changed.
-static ALIGNED(16) u8 tail_magic[kShadowAlignment - 1];
+alignas(16) static u8 tail_magic[kShadowAlignment - 1];
 static uptr max_malloc_size;
 
 bool HwasanChunkView::IsAllocated() const {
diff --git a/compiler-rt/lib/hwasan/hwasan_thread_list.cpp b/compiler-rt/lib/hwasan/hwasan_thread_list.cpp
index e56d19aad2673..794cfb7550d77 100644
--- a/compiler-rt/lib/hwasan/hwasan_thread_list.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_thread_list.cpp
@@ -14,15 +14,15 @@ ThreadArgRetval &hwasanThreadArgRetval() { return *thread_data; }
 void InitThreadList(uptr storage, uptr size) {
   CHECK_EQ(hwasan_thread_list, nullptr);
 
-  static ALIGNED(alignof(
-      HwasanThreadList)) char thread_list_placeholder[sizeof(HwasanThreadList)];
+  alignas(alignof(HwasanThreadList)) static char
+      thread_list_placeholder[sizeof(HwasanThreadList)];
   hwasan_thread_list =
       new (thread_list_placeholder) HwasanThreadList(storage, size);
 
   CHECK_EQ(thread_data, nullptr);
 
-  static ALIGNED(alignof(
-      ThreadArgRetval)) char thread_data_placeholder[sizeof(ThreadArgRetval)];
+  alignas(alignof(ThreadArgRetval)) static char
+      thread_data_placeholder[sizeof(ThreadArgRetval)];
   thread_data = new (thread_data_placeholder) ThreadArgRetval();
 }
 
diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp
index 0ecded8b28cdb..183df6e5ca14b 100644
--- a/compiler-rt/lib/lsan/lsan_common.cpp
+++ b/compiler-rt/lib/lsan/lsan_common.cpp
@@ -108,7 +108,7 @@ class LeakSuppressionContext {
   void PrintMatchedSuppressions();
 };
 
-ALIGNED(64) static char suppression_placeholder[sizeof(LeakSuppressionContext)];
+alignas(64) static char suppression_placeholder[sizeof(LeakSuppressionContext)];
 static LeakSuppressionContext *suppression_ctx = nullptr;
 static const char kSuppressionLeak[] = "leak";
 static const char *kSuppressionTypes[] = {kSuppressionLeak};
diff --git a/compiler-rt/lib/lsan/lsan_common_linux.cpp b/compiler-rt/lib/lsan/lsan_common_linux.cpp
index 692ad35169e1d..7a0b2f038be0d 100644
--- a/compiler-rt/lib/lsan/lsan_common_linux.cpp
+++ b/compiler-rt/lib/lsan/lsan_common_linux.cpp
@@ -28,7 +28,7 @@ namespace __lsan {
 
 static const char kLinkerName[] = "ld";
 
-static char linker_placeholder[sizeof(LoadedModule)] ALIGNED(64);
+alignas(64) static char linker_placeholder[sizeof(LoadedModule)];
 static LoadedModule *linker = nullptr;
 
 static bool IsLinker(const LoadedModule& module) {
diff --git a/compiler-rt/lib/lsan/lsan_thread.cpp b/compiler-rt/lib/lsan/lsan_thread.cpp
index 8aa3111eecf7d..07c7b923623fa 100644
--- a/compiler-rt/lib/lsan/lsan_thread.cpp
+++ b/compiler-rt/lib/lsan/lsan_thread.cpp
@@ -35,12 +35,12 @@ static ThreadContextBase *CreateThreadContext(u32 tid) {
 }
 
 void InitializeThreads() {
-  static ALIGNED(alignof(
-      ThreadRegistry)) char thread_registry_placeholder[sizeof(ThreadRegistry)];
+  alignas(alignof(ThreadRegistry)) static char
+      thread_registry_placeholder[sizeof(ThreadRegistry)];
   thread_registry =
       new (thread_registry_placeholder) ThreadRegistry(CreateThreadContext);
 
-  static ALIGNED(alignof(ThreadArgRetval)) char
+  alignas(alignof(ThreadArgRetval)) static char
       thread_arg_retval_placeholder[sizeof(ThreadArgRetval)];
   thread_arg_retval = new (thread_arg_retval_placeholder) ThreadArgRetval();
 }
diff --git a/compiler-rt/lib/memprof/memprof_thread.cpp b/compiler-rt/lib/memprof/memprof_thread.cpp
index 9512a87cf98e4..e2bca9bb422f7 100644
--- a/compiler-rt/lib/memprof/memprof_thread.cpp
+++ b/compiler-rt/lib/memprof/memprof_thread.cpp
@@ -37,7 +37,7 @@ void MemprofThreadContext::OnFinished() {
   thread = nullptr;
 }
 
-static ALIGNED(16) char thread_registry_placeholder[sizeof(ThreadRegistry)];
+alignas(16) static char thread_registry_placeholder[sizeof(ThreadRegistry)];
 static ThreadRegistry *memprof_thread_registry;
 
 static Mutex mu_for_thread_context;
diff --git a/compiler-rt/lib/msan/msan.cpp b/compiler-rt/lib/msan/msan.cpp
index b04a72595b93d..2ee05f43ec5e5 100644
--- a/compiler-rt/lib/msan/msan.cpp
+++ b/compiler-rt/lib/msan/msan.cpp
@@ -56,12 +56,11 @@ THREADLOCAL u64 __msan_retval_tls[kMsanRetvalTlsSize / sizeof(u64)];
 SANITIZER_INTERFACE_ATTRIBUTE
 THREADLOCAL u32 __msan_retval_origin_tls;
 
-SANITIZER_INTERFACE_ATTRIBUTE
-ALIGNED(16) THREADLOCAL u64 __msan_va_arg_tls[kMsanParamTlsSize / sizeof(u64)];
+alignas(16) SANITIZER_INTERFACE_ATTRIBUTE THREADLOCAL u64
+    __msan_va_arg_tls[kMsanParamTlsSize / sizeof(u64)];
 
-SANITIZER_INTERFACE_ATTRIBUTE
-ALIGNED(16)
-THREADLOCAL u32 __msan_va_arg_origin_tls[kMsanParamTlsSize / sizeof(u32)];
+alignas(16) SANITIZER_INTERFACE_ATTRIBUTE THREADLOCAL u32
+    __msan_va_arg_origin_tls[kMsanParamTlsSize / sizeof(u32)];
 
 SANITIZER_INTERFACE_ATTRIBUTE
 THREADLOCAL u64 __msan_va_arg_overflow_size_tls;
diff --git a/compiler-rt/lib/msan/msan_allocator.h b/compiler-rt/lib/msan/msan_allocator.h
index c2a38a401f3b6..109e24dc509a3 100644
--- a/compiler-rt/lib/msan/msan_allocator.h
+++ b/compiler-rt/lib/msan/msan_allocator.h
@@ -19,7 +19,7 @@ namespace __msan {
 
 struct MsanThreadLocalMallocStorage {
   // Allocator cache contains atomic_uint64_t which must be 8-byte aligned.
-  ALIGNED(8) uptr allocator_cache[96 * (512 * 8 + 16)];  // Opaque.
+  alignas(8) uptr allocator_cache[96 * (512 * 8 + 16)];  // Opaque.
   void Init();
   void CommitBack();
 
diff --git a/compiler-rt/lib/msan/msan_interceptors.cpp b/compiler-rt/lib/msan/msan_interceptors.cpp
index 789b739b41189..c540523e0eaed 100644
--- a/compiler-rt/lib/msan/msan_interceptors.cpp
+++ b/compiler-rt/lib/msan/msan_interceptors.cpp
@@ -1255,7 +1255,7 @@ struct InterceptorContext {
   }
 };
 
-static ALIGNED(64) char interceptor_placeholder[sizeof(InterceptorContext)];
+alignas(64) static char interceptor_placeholder[sizeof(InterceptorContext)];
 InterceptorContext *interceptor_ctx() {
   return reinterpret_cast<InterceptorContext*>(&interceptor_placeholder[0]);
 }
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
index 0513ae36fbc72..1d5058c81acbc 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
@@ -25,7 +25,7 @@ namespace __sanitizer {
 const char *PrimaryAllocatorName = "SizeClassAllocator";
 const char *SecondaryAllocatorName = "LargeMmapAllocator";
 
-static ALIGNED(64) char internal_alloc_placeholder[sizeof(InternalAllocator)];
+alignas(64) static char internal_alloc_placeholder[sizeof(InternalAllocator)];
 static atomic_uint8_t internal_allocator_initialized;
 static StaticSpinMutex internal_alloc_init_mu;
 
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h
index 52fe3fe3d15bd..602b197c42ae3 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h
@@ -278,7 +278,7 @@ class SizeClassAllocator32 {
   static const uptr kRegionSize = 1 << kRegionSizeLog;
   static const uptr kNumPossibleRegions = kSpaceSize / kRegionSize;
 
-  struct ALIGNED(SANITIZER_CACHE_LINE_SIZE) SizeClassInfo {
+  struct alignas(SANITIZER_CACHE_LINE_SIZE) SizeClassInfo {
     StaticSpinMutex mutex;
     IntrusiveList<TransferBatch> free_list;
     u32 rand_state;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
index 6e73065d7f53c..16cdc4ce53b35 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
@@ -667,7 +667,7 @@ class SizeClassAllocator64 {
     u64 last_released_bytes;
   };
 
-  struct ALIGNED(SANITIZER_CACHE_LINE_SIZE) RegionInfo {
+  struct alignas(SANITIZER_CACHE_LINE_SIZE) RegionInfo {
     Mutex mutex;
     uptr num_freed_chunks;  // Number of elements in the freearray.
     uptr mapped_free_array;  // Bytes mapped for freearray.
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h b/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h
index 0609a11ffdebb..257c457351dbc 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h
@@ -61,7 +61,7 @@ struct atomic_uint32_t {
 struct atomic_uint64_t {
   typedef u64 Type;
   // On 32-bit platforms u64 is not necessary aligned on 8 bytes.
-  volatile ALIGNED(8) Type val_dont_use;
+  alignas(8) volatile Type val_dont_use;
 };
 
 struct atomic_uintptr_t {
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cpp b/compiler-rt/lib/ubsan/ubsan_diag.cpp
index 67e884e4916c5..1625dfe89eb11 100644
--- a/compiler-rt/lib/ubsan/ubsan_diag.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_diag.cpp
@@ -402,7 +402,7 @@ ScopedReport::~ScopedReport() {
     Die();
 }
 
-ALIGNED(64) static char suppression_placeholder[sizeof(SuppressionContext)];
+alignas(64) static char suppression_placeholder[sizeof(SuppressionContext)];
 static SuppressionContext *suppression_ctx = nullptr;
 static const char kVptrCheck[] = "vptr_check";
 static const char *kSuppressionTypes[] = {

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 15, 2024

@llvm/pr-subscribers-pgo

Author: Fangrui Song (MaskRay)

Changes

C++11 alignas is already used extensively. alignas must precede
static, so adjust the ordering accordingly.

msan.cpp: Clang 15 doesn't allow __attribute__((visibility("default"))) alignas(16).
Use the order alignas(16) SANITIZER_INTERFACE_ATTRIBUTE. Tested with Clang 7.


Full diff: https://github.com/llvm/llvm-project/pull/98958.diff

20 Files Affected:

  • (modified) compiler-rt/lib/asan/asan_globals_win.cpp (+4-4)
  • (modified) compiler-rt/lib/asan/asan_malloc_linux.cpp (+2-2)
  • (modified) compiler-rt/lib/asan/asan_report.cpp (+2-2)
  • (modified) compiler-rt/lib/asan/asan_suppressions.cpp (+1-1)
  • (modified) compiler-rt/lib/asan/asan_thread.cpp (+4-4)
  • (modified) compiler-rt/lib/dfsan/dfsan_allocator.h (+1-1)
  • (modified) compiler-rt/lib/hwasan/hwasan_allocator.cpp (+1-1)
  • (modified) compiler-rt/lib/hwasan/hwasan_thread_list.cpp (+4-4)
  • (modified) compiler-rt/lib/lsan/lsan_common.cpp (+1-1)
  • (modified) compiler-rt/lib/lsan/lsan_common_linux.cpp (+1-1)
  • (modified) compiler-rt/lib/lsan/lsan_thread.cpp (+3-3)
  • (modified) compiler-rt/lib/memprof/memprof_thread.cpp (+1-1)
  • (modified) compiler-rt/lib/msan/msan.cpp (+4-5)
  • (modified) compiler-rt/lib/msan/msan_allocator.h (+1-1)
  • (modified) compiler-rt/lib/msan/msan_interceptors.cpp (+1-1)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp (+1-1)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h (+1-1)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h (+1-1)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_atomic.h (+1-1)
  • (modified) compiler-rt/lib/ubsan/ubsan_diag.cpp (+1-1)
diff --git a/compiler-rt/lib/asan/asan_globals_win.cpp b/compiler-rt/lib/asan/asan_globals_win.cpp
index 19af88ab12b40..9442cc35d5ab7 100644
--- a/compiler-rt/lib/asan/asan_globals_win.cpp
+++ b/compiler-rt/lib/asan/asan_globals_win.cpp
@@ -17,10 +17,10 @@ namespace __asan {
 
 #pragma section(".ASAN$GA", read, write)
 #pragma section(".ASAN$GZ", read, write)
-extern "C" __declspec(allocate(".ASAN$GA"))
-    ALIGNED(sizeof(__asan_global)) __asan_global __asan_globals_start = {};
-extern "C" __declspec(allocate(".ASAN$GZ"))
-    ALIGNED(sizeof(__asan_global)) __asan_global __asan_globals_end = {};
+extern "C" alignas(sizeof(__asan_global))
+    __declspec(allocate(".ASAN$GA")) __asan_global __asan_globals_start = {};
+extern "C" alignas(sizeof(__asan_global))
+    __declspec(allocate(".ASAN$GZ")) __asan_global __asan_globals_end = {};
 #pragma comment(linker, "/merge:.ASAN=.data")
 
 static void call_on_globals(void (*hook)(__asan_global *, uptr)) {
diff --git a/compiler-rt/lib/asan/asan_malloc_linux.cpp b/compiler-rt/lib/asan/asan_malloc_linux.cpp
index d426b923c94ed..08a63045c4e65 100644
--- a/compiler-rt/lib/asan/asan_malloc_linux.cpp
+++ b/compiler-rt/lib/asan/asan_malloc_linux.cpp
@@ -185,11 +185,11 @@ struct MallocDebugL {
   void* (*valloc)(uptr size);
 };
 
-ALIGNED(32) const MallocDebugK asan_malloc_dispatch_k = {
+alignas(32) const MallocDebugK asan_malloc_dispatch_k = {
     WRAP(malloc),  WRAP(free),     WRAP(calloc),
     WRAP(realloc), WRAP(memalign), WRAP(malloc_usable_size)};
 
-ALIGNED(32) const MallocDebugL asan_malloc_dispatch_l = {
+alignas(32) const MallocDebugL asan_malloc_dispatch_l = {
     WRAP(calloc),         WRAP(free),               WRAP(mallinfo),
     WRAP(malloc),         WRAP(malloc_usable_size), WRAP(memalign),
     WRAP(posix_memalign), WRAP(pvalloc),            WRAP(realloc),
diff --git a/compiler-rt/lib/asan/asan_report.cpp b/compiler-rt/lib/asan/asan_report.cpp
index c9730dd368cb4..fd590e401f67f 100644
--- a/compiler-rt/lib/asan/asan_report.cpp
+++ b/compiler-rt/lib/asan/asan_report.cpp
@@ -34,8 +34,8 @@ namespace __asan {
 // -------------------- User-specified callbacks ----------------- {{{1
 static void (*error_report_callback)(const char*);
 using ErrorMessageBuffer = InternalMmapVectorNoCtor<char, true>;
-static ALIGNED(
-    alignof(ErrorMessageBuffer)) char error_message_buffer_placeholder
+alignas(
+    alignof(ErrorMessageBuffer)) static char error_message_buffer_placeholder
     [sizeof(ErrorMessageBuffer)];
 static ErrorMessageBuffer *error_message_buffer = nullptr;
 static Mutex error_message_buf_mutex;
diff --git a/compiler-rt/lib/asan/asan_suppressions.cpp b/compiler-rt/lib/asan/asan_suppressions.cpp
index 6cee674960395..94289d14d7e78 100644
--- a/compiler-rt/lib/asan/asan_suppressions.cpp
+++ b/compiler-rt/lib/asan/asan_suppressions.cpp
@@ -20,7 +20,7 @@
 
 namespace __asan {
 
-ALIGNED(64) static char suppression_placeholder[sizeof(SuppressionContext)];
+alignas(64) static char suppression_placeholder[sizeof(SuppressionContext)];
 static SuppressionContext *suppression_ctx = nullptr;
 static const char kInterceptorName[] = "interceptor_name";
 static const char kInterceptorViaFunction[] = "interceptor_via_fun";
diff --git a/compiler-rt/lib/asan/asan_thread.cpp b/compiler-rt/lib/asan/asan_thread.cpp
index 480a423952e8f..c79c33ab01342 100644
--- a/compiler-rt/lib/asan/asan_thread.cpp
+++ b/compiler-rt/lib/asan/asan_thread.cpp
@@ -67,10 +67,10 @@ static void InitThreads() {
   // thread before all TSD destructors will be called for it.
 
   // MIPS requires aligned address
-  static ALIGNED(alignof(
-      ThreadRegistry)) char thread_registry_placeholder[sizeof(ThreadRegistry)];
-  static ALIGNED(alignof(
-      ThreadArgRetval)) char thread_data_placeholder[sizeof(ThreadArgRetval)];
+  alignas(alignof(ThreadRegistry)) static char
+      thread_registry_placeholder[sizeof(ThreadRegistry)];
+  alignas(alignof(ThreadArgRetval)) static char
+      thread_data_placeholder[sizeof(ThreadArgRetval)];
 
   asan_thread_registry =
       new (thread_registry_placeholder) ThreadRegistry(GetAsanThreadContext);
diff --git a/compiler-rt/lib/dfsan/dfsan_allocator.h b/compiler-rt/lib/dfsan/dfsan_allocator.h
index 3b4171b6314d6..6ff24fc57a855 100644
--- a/compiler-rt/lib/dfsan/dfsan_allocator.h
+++ b/compiler-rt/lib/dfsan/dfsan_allocator.h
@@ -18,7 +18,7 @@
 namespace __dfsan {
 
 struct DFsanThreadLocalMallocStorage {
-  ALIGNED(8) uptr allocator_cache[96 * (512 * 8 + 16)];  // Opaque.
+  alignas(8) uptr allocator_cache[96 * (512 * 8 + 16)];  // Opaque.
   void CommitBack();
 
  private:
diff --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
index 7771127731de8..75dbb336e3445 100644
--- a/compiler-rt/lib/hwasan/hwasan_allocator.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
@@ -44,7 +44,7 @@ enum {
 
 
 // Initialized in HwasanAllocatorInit, an never changed.
-static ALIGNED(16) u8 tail_magic[kShadowAlignment - 1];
+alignas(16) static u8 tail_magic[kShadowAlignment - 1];
 static uptr max_malloc_size;
 
 bool HwasanChunkView::IsAllocated() const {
diff --git a/compiler-rt/lib/hwasan/hwasan_thread_list.cpp b/compiler-rt/lib/hwasan/hwasan_thread_list.cpp
index e56d19aad2673..794cfb7550d77 100644
--- a/compiler-rt/lib/hwasan/hwasan_thread_list.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_thread_list.cpp
@@ -14,15 +14,15 @@ ThreadArgRetval &hwasanThreadArgRetval() { return *thread_data; }
 void InitThreadList(uptr storage, uptr size) {
   CHECK_EQ(hwasan_thread_list, nullptr);
 
-  static ALIGNED(alignof(
-      HwasanThreadList)) char thread_list_placeholder[sizeof(HwasanThreadList)];
+  alignas(alignof(HwasanThreadList)) static char
+      thread_list_placeholder[sizeof(HwasanThreadList)];
   hwasan_thread_list =
       new (thread_list_placeholder) HwasanThreadList(storage, size);
 
   CHECK_EQ(thread_data, nullptr);
 
-  static ALIGNED(alignof(
-      ThreadArgRetval)) char thread_data_placeholder[sizeof(ThreadArgRetval)];
+  alignas(alignof(ThreadArgRetval)) static char
+      thread_data_placeholder[sizeof(ThreadArgRetval)];
   thread_data = new (thread_data_placeholder) ThreadArgRetval();
 }
 
diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp
index 0ecded8b28cdb..183df6e5ca14b 100644
--- a/compiler-rt/lib/lsan/lsan_common.cpp
+++ b/compiler-rt/lib/lsan/lsan_common.cpp
@@ -108,7 +108,7 @@ class LeakSuppressionContext {
   void PrintMatchedSuppressions();
 };
 
-ALIGNED(64) static char suppression_placeholder[sizeof(LeakSuppressionContext)];
+alignas(64) static char suppression_placeholder[sizeof(LeakSuppressionContext)];
 static LeakSuppressionContext *suppression_ctx = nullptr;
 static const char kSuppressionLeak[] = "leak";
 static const char *kSuppressionTypes[] = {kSuppressionLeak};
diff --git a/compiler-rt/lib/lsan/lsan_common_linux.cpp b/compiler-rt/lib/lsan/lsan_common_linux.cpp
index 692ad35169e1d..7a0b2f038be0d 100644
--- a/compiler-rt/lib/lsan/lsan_common_linux.cpp
+++ b/compiler-rt/lib/lsan/lsan_common_linux.cpp
@@ -28,7 +28,7 @@ namespace __lsan {
 
 static const char kLinkerName[] = "ld";
 
-static char linker_placeholder[sizeof(LoadedModule)] ALIGNED(64);
+alignas(64) static char linker_placeholder[sizeof(LoadedModule)];
 static LoadedModule *linker = nullptr;
 
 static bool IsLinker(const LoadedModule& module) {
diff --git a/compiler-rt/lib/lsan/lsan_thread.cpp b/compiler-rt/lib/lsan/lsan_thread.cpp
index 8aa3111eecf7d..07c7b923623fa 100644
--- a/compiler-rt/lib/lsan/lsan_thread.cpp
+++ b/compiler-rt/lib/lsan/lsan_thread.cpp
@@ -35,12 +35,12 @@ static ThreadContextBase *CreateThreadContext(u32 tid) {
 }
 
 void InitializeThreads() {
-  static ALIGNED(alignof(
-      ThreadRegistry)) char thread_registry_placeholder[sizeof(ThreadRegistry)];
+  alignas(alignof(ThreadRegistry)) static char
+      thread_registry_placeholder[sizeof(ThreadRegistry)];
   thread_registry =
       new (thread_registry_placeholder) ThreadRegistry(CreateThreadContext);
 
-  static ALIGNED(alignof(ThreadArgRetval)) char
+  alignas(alignof(ThreadArgRetval)) static char
       thread_arg_retval_placeholder[sizeof(ThreadArgRetval)];
   thread_arg_retval = new (thread_arg_retval_placeholder) ThreadArgRetval();
 }
diff --git a/compiler-rt/lib/memprof/memprof_thread.cpp b/compiler-rt/lib/memprof/memprof_thread.cpp
index 9512a87cf98e4..e2bca9bb422f7 100644
--- a/compiler-rt/lib/memprof/memprof_thread.cpp
+++ b/compiler-rt/lib/memprof/memprof_thread.cpp
@@ -37,7 +37,7 @@ void MemprofThreadContext::OnFinished() {
   thread = nullptr;
 }
 
-static ALIGNED(16) char thread_registry_placeholder[sizeof(ThreadRegistry)];
+alignas(16) static char thread_registry_placeholder[sizeof(ThreadRegistry)];
 static ThreadRegistry *memprof_thread_registry;
 
 static Mutex mu_for_thread_context;
diff --git a/compiler-rt/lib/msan/msan.cpp b/compiler-rt/lib/msan/msan.cpp
index b04a72595b93d..2ee05f43ec5e5 100644
--- a/compiler-rt/lib/msan/msan.cpp
+++ b/compiler-rt/lib/msan/msan.cpp
@@ -56,12 +56,11 @@ THREADLOCAL u64 __msan_retval_tls[kMsanRetvalTlsSize / sizeof(u64)];
 SANITIZER_INTERFACE_ATTRIBUTE
 THREADLOCAL u32 __msan_retval_origin_tls;
 
-SANITIZER_INTERFACE_ATTRIBUTE
-ALIGNED(16) THREADLOCAL u64 __msan_va_arg_tls[kMsanParamTlsSize / sizeof(u64)];
+alignas(16) SANITIZER_INTERFACE_ATTRIBUTE THREADLOCAL u64
+    __msan_va_arg_tls[kMsanParamTlsSize / sizeof(u64)];
 
-SANITIZER_INTERFACE_ATTRIBUTE
-ALIGNED(16)
-THREADLOCAL u32 __msan_va_arg_origin_tls[kMsanParamTlsSize / sizeof(u32)];
+alignas(16) SANITIZER_INTERFACE_ATTRIBUTE THREADLOCAL u32
+    __msan_va_arg_origin_tls[kMsanParamTlsSize / sizeof(u32)];
 
 SANITIZER_INTERFACE_ATTRIBUTE
 THREADLOCAL u64 __msan_va_arg_overflow_size_tls;
diff --git a/compiler-rt/lib/msan/msan_allocator.h b/compiler-rt/lib/msan/msan_allocator.h
index c2a38a401f3b6..109e24dc509a3 100644
--- a/compiler-rt/lib/msan/msan_allocator.h
+++ b/compiler-rt/lib/msan/msan_allocator.h
@@ -19,7 +19,7 @@ namespace __msan {
 
 struct MsanThreadLocalMallocStorage {
   // Allocator cache contains atomic_uint64_t which must be 8-byte aligned.
-  ALIGNED(8) uptr allocator_cache[96 * (512 * 8 + 16)];  // Opaque.
+  alignas(8) uptr allocator_cache[96 * (512 * 8 + 16)];  // Opaque.
   void Init();
   void CommitBack();
 
diff --git a/compiler-rt/lib/msan/msan_interceptors.cpp b/compiler-rt/lib/msan/msan_interceptors.cpp
index 789b739b41189..c540523e0eaed 100644
--- a/compiler-rt/lib/msan/msan_interceptors.cpp
+++ b/compiler-rt/lib/msan/msan_interceptors.cpp
@@ -1255,7 +1255,7 @@ struct InterceptorContext {
   }
 };
 
-static ALIGNED(64) char interceptor_placeholder[sizeof(InterceptorContext)];
+alignas(64) static char interceptor_placeholder[sizeof(InterceptorContext)];
 InterceptorContext *interceptor_ctx() {
   return reinterpret_cast<InterceptorContext*>(&interceptor_placeholder[0]);
 }
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
index 0513ae36fbc72..1d5058c81acbc 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
@@ -25,7 +25,7 @@ namespace __sanitizer {
 const char *PrimaryAllocatorName = "SizeClassAllocator";
 const char *SecondaryAllocatorName = "LargeMmapAllocator";
 
-static ALIGNED(64) char internal_alloc_placeholder[sizeof(InternalAllocator)];
+alignas(64) static char internal_alloc_placeholder[sizeof(InternalAllocator)];
 static atomic_uint8_t internal_allocator_initialized;
 static StaticSpinMutex internal_alloc_init_mu;
 
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h
index 52fe3fe3d15bd..602b197c42ae3 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h
@@ -278,7 +278,7 @@ class SizeClassAllocator32 {
   static const uptr kRegionSize = 1 << kRegionSizeLog;
   static const uptr kNumPossibleRegions = kSpaceSize / kRegionSize;
 
-  struct ALIGNED(SANITIZER_CACHE_LINE_SIZE) SizeClassInfo {
+  struct alignas(SANITIZER_CACHE_LINE_SIZE) SizeClassInfo {
     StaticSpinMutex mutex;
     IntrusiveList<TransferBatch> free_list;
     u32 rand_state;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
index 6e73065d7f53c..16cdc4ce53b35 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
@@ -667,7 +667,7 @@ class SizeClassAllocator64 {
     u64 last_released_bytes;
   };
 
-  struct ALIGNED(SANITIZER_CACHE_LINE_SIZE) RegionInfo {
+  struct alignas(SANITIZER_CACHE_LINE_SIZE) RegionInfo {
     Mutex mutex;
     uptr num_freed_chunks;  // Number of elements in the freearray.
     uptr mapped_free_array;  // Bytes mapped for freearray.
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h b/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h
index 0609a11ffdebb..257c457351dbc 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h
@@ -61,7 +61,7 @@ struct atomic_uint32_t {
 struct atomic_uint64_t {
   typedef u64 Type;
   // On 32-bit platforms u64 is not necessary aligned on 8 bytes.
-  volatile ALIGNED(8) Type val_dont_use;
+  alignas(8) volatile Type val_dont_use;
 };
 
 struct atomic_uintptr_t {
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cpp b/compiler-rt/lib/ubsan/ubsan_diag.cpp
index 67e884e4916c5..1625dfe89eb11 100644
--- a/compiler-rt/lib/ubsan/ubsan_diag.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_diag.cpp
@@ -402,7 +402,7 @@ ScopedReport::~ScopedReport() {
     Die();
 }
 
-ALIGNED(64) static char suppression_placeholder[sizeof(SuppressionContext)];
+alignas(64) static char suppression_placeholder[sizeof(SuppressionContext)];
 static SuppressionContext *suppression_ctx = nullptr;
 static const char kVptrCheck[] = "vptr_check";
 static const char *kSuppressionTypes[] = {

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 148d90729e9fa132f170ba0627bcfb9ee90a0f38 6e393e84c1145693d12c0bcfef1a6c0b44855aac --extensions cpp,h -- compiler-rt/lib/asan/asan_globals_win.cpp compiler-rt/lib/asan/asan_malloc_linux.cpp compiler-rt/lib/asan/asan_report.cpp compiler-rt/lib/asan/asan_suppressions.cpp compiler-rt/lib/asan/asan_thread.cpp compiler-rt/lib/dfsan/dfsan_allocator.h compiler-rt/lib/hwasan/hwasan_allocator.cpp compiler-rt/lib/hwasan/hwasan_thread_list.cpp compiler-rt/lib/lsan/lsan_common.cpp compiler-rt/lib/lsan/lsan_common_linux.cpp compiler-rt/lib/lsan/lsan_thread.cpp compiler-rt/lib/memprof/memprof_thread.cpp compiler-rt/lib/msan/msan.cpp compiler-rt/lib/msan/msan_allocator.h compiler-rt/lib/msan/msan_interceptors.cpp compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h compiler-rt/lib/sanitizer_common/sanitizer_atomic.h compiler-rt/lib/ubsan/ubsan_diag.cpp
View the diff from clang-format here.
diff --git a/compiler-rt/lib/asan/asan_globals_win.cpp b/compiler-rt/lib/asan/asan_globals_win.cpp
index 9442cc35d5..208080dfeb 100644
--- a/compiler-rt/lib/asan/asan_globals_win.cpp
+++ b/compiler-rt/lib/asan/asan_globals_win.cpp
@@ -21,7 +21,7 @@ extern "C" alignas(sizeof(__asan_global))
     __declspec(allocate(".ASAN$GA")) __asan_global __asan_globals_start = {};
 extern "C" alignas(sizeof(__asan_global))
     __declspec(allocate(".ASAN$GZ")) __asan_global __asan_globals_end = {};
-#pragma comment(linker, "/merge:.ASAN=.data")
+#  pragma comment(linker, "/merge:.ASAN=.data")
 
 static void call_on_globals(void (*hook)(__asan_global *, uptr)) {
   __asan_global *start = &__asan_globals_start + 1;
diff --git a/compiler-rt/lib/asan/asan_malloc_linux.cpp b/compiler-rt/lib/asan/asan_malloc_linux.cpp
index 08a63045c4..d0d698ae94 100644
--- a/compiler-rt/lib/asan/asan_malloc_linux.cpp
+++ b/compiler-rt/lib/asan/asan_malloc_linux.cpp
@@ -190,9 +190,15 @@ alignas(32) const MallocDebugK asan_malloc_dispatch_k = {
     WRAP(realloc), WRAP(memalign), WRAP(malloc_usable_size)};
 
 alignas(32) const MallocDebugL asan_malloc_dispatch_l = {
-    WRAP(calloc),         WRAP(free),               WRAP(mallinfo),
-    WRAP(malloc),         WRAP(malloc_usable_size), WRAP(memalign),
-    WRAP(posix_memalign), WRAP(pvalloc),            WRAP(realloc),
+    WRAP(calloc),
+    WRAP(free),
+    WRAP(mallinfo),
+    WRAP(malloc),
+    WRAP(malloc_usable_size),
+    WRAP(memalign),
+    WRAP(posix_memalign),
+    WRAP(pvalloc),
+    WRAP(realloc),
     WRAP(valloc)};
 
 namespace __asan {

@@ -34,8 +34,8 @@ namespace __asan {
// -------------------- User-specified callbacks ----------------- {{{1
static void (*error_report_callback)(const char*);
using ErrorMessageBuffer = InternalMmapVectorNoCtor<char, true>;
static ALIGNED(
alignof(ErrorMessageBuffer)) char error_message_buffer_placeholder
alignas(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is reordering static and align is necessary,
I realy like static being the first.

The same for the rest.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignas (attribute specifier) must precede static (storage class specifier) in the decl-specifier. Both Clang and GCC have errors if the order is swapped.

I think the relevant rules are here:

https://eel.is/c++draft/dcl.pre#nt:simple-declaration specifies the order: attribute-specifier-seq decl-specifier-seq init-declarator-list ;

@MaskRay MaskRay merged commit ba66d60 into main Jul 15, 2024
12 of 14 checks passed
@MaskRay MaskRay deleted the users/MaskRay/spr/sanitizer-replace-aligned-with-alignas branch July 15, 2024 23:12
MaskRay added a commit that referenced this pull request Jul 16, 2024
sayhaan pushed a commit to sayhaan/llvm-project that referenced this pull request Jul 16, 2024
Summary:
Similar to llvm#98958.

Pull Request: llvm#98959

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D59822444
MaskRay added a commit that referenced this pull request Jul 16, 2024
Similar to #98958.

The relands 656f617 , which
was reverted due to an issue in tsan_platform_mac.cpp

Pull Request: #98959
sgundapa pushed a commit to sgundapa/upstream_effort that referenced this pull request Jul 23, 2024
sgundapa pushed a commit to sgundapa/upstream_effort that referenced this pull request Jul 23, 2024
Similar to llvm#98958.

The relands 656f617 , which
was reverted due to an issue in tsan_platform_mac.cpp

Pull Request: llvm#98959
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
Summary:
C++11 `alignas` is already used extensively. `alignas` must precede
`static`, so adjust the ordering accordingly.

msan.cpp: Clang 15 doesn't allow `__attribute__((visibility("default"))) alignas(16)`.
Use the order `alignas(16) SANITIZER_INTERFACE_ATTRIBUTE`. Tested with Clang 7.

Pull Request: #98958

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251486
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
Summary:
Similar to #98958.

Pull Request: #98959

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251655
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
Summary:
Similar to #98958.

The relands 656f617 , which
was reverted due to an issue in tsan_platform_mac.cpp

Pull Request: #98959

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60250841
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler-rt:asan Address sanitizer compiler-rt:hwasan Hardware-assisted address sanitizer compiler-rt:lsan Leak sanitizer compiler-rt:msan Memory sanitizer compiler-rt:sanitizer compiler-rt:ubsan Undefined behavior sanitizer compiler-rt PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants