[compiler-rt] [nsan] Use ALIGNED instead of alignas (NFC) (PR #98933)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 09:59:23 PDT 2024


https://github.com/nikic created https://github.com/llvm/llvm-project/pull/98933

When preceded by SANITIZER_INTERFACE_ATTRIBUTE, use the ALIGNED macro instead of alignas, because clang 15 and older do not support this. See https://clang.godbolt.org/z/Wj1193xWK.

This was broken by https://github.com/llvm/llvm-project/pull/96142 as part of other style changes.

>From 2cc345d1981d4f691b62c5b635372a365248a382 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Mon, 15 Jul 2024 18:19:36 +0200
Subject: [PATCH] [nsan] Use ALIGNED instead of alignas (NFC)

When preceded by SANITIZER_INTERFACE_ATTRIBUTE, use the ALIGNED
macro instead of alignas, because clang 15 and older does not
support this. See https://clang.godbolt.org/z/Wj1193xWK.
---
 compiler-rt/lib/nsan/nsan.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/compiler-rt/lib/nsan/nsan.cpp b/compiler-rt/lib/nsan/nsan.cpp
index e5a9b7a036e0e..10010495e3ee9 100644
--- a/compiler-rt/lib/nsan/nsan.cpp
+++ b/compiler-rt/lib/nsan/nsan.cpp
@@ -391,23 +391,23 @@ __nsan_dump_shadow_mem(const u8 *addr, size_t size_bytes, size_t bytes_per_line,
 }
 
 SANITIZER_INTERFACE_ATTRIBUTE
-alignas(16) thread_local uptr __nsan_shadow_ret_tag = 0;
+ALIGNED(16) thread_local uptr __nsan_shadow_ret_tag = 0;
 
 SANITIZER_INTERFACE_ATTRIBUTE
-alignas(16) thread_local char __nsan_shadow_ret_ptr[kMaxVectorWidth *
-                                                    sizeof(__float128)];
+ALIGNED(16)
+thread_local char __nsan_shadow_ret_ptr[kMaxVectorWidth * sizeof(__float128)];
 
 SANITIZER_INTERFACE_ATTRIBUTE
-alignas(16) thread_local uptr __nsan_shadow_args_tag = 0;
+ALIGNED(16) thread_local uptr __nsan_shadow_args_tag = 0;
 
 // Maximum number of args. This should be enough for anyone (tm). An alternate
 // scheme is to have the generated code create an alloca and make
 // __nsan_shadow_args_ptr point ot the alloca.
 constexpr const int kMaxNumArgs = 128;
 SANITIZER_INTERFACE_ATTRIBUTE
-alignas(
-    16) thread_local char __nsan_shadow_args_ptr[kMaxVectorWidth * kMaxNumArgs *
-                                                 sizeof(__float128)];
+ALIGNED(16)
+thread_local char __nsan_shadow_args_ptr[kMaxVectorWidth * kMaxNumArgs *
+                                         sizeof(__float128)];
 
 enum ContinuationType { // Keep in sync with instrumentation pass.
   kContinueWithShadow = 0,



More information about the llvm-commits mailing list