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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

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

Author: Nikita Popov (nikic)

<details>
<summary>Changes</summary>

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.

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


1 Files Affected:

- (modified) compiler-rt/lib/nsan/nsan.cpp (+7-7) 


``````````diff
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,

``````````

</details>


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


More information about the llvm-commits mailing list