[PATCH] D44246: [sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into a template. NFC.

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 04:30:17 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1707fa337468: [sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into a template. (authored by kubamracek).
Herald added a subscriber: jfb.
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D44246?vs=143181&id=223500#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D44246/new/

https://reviews.llvm.org/D44246

Files:
  compiler-rt/lib/sanitizer_common/sanitizer_atomic.h


Index: compiler-rt/lib/sanitizer_common/sanitizer_atomic.h
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_atomic.h
+++ compiler-rt/lib/sanitizer_common/sanitizer_atomic.h
@@ -27,36 +27,18 @@
   memory_order_seq_cst = 1 << 5
 };
 
-struct atomic_uint8_t {
-  typedef u8 Type;
-  volatile Type val_dont_use;
-};
-
-struct atomic_uint16_t {
-  typedef u16 Type;
-  volatile Type val_dont_use;
-};
-
-struct atomic_sint32_t {
-  typedef s32 Type;
-  volatile Type val_dont_use;
-};
-
-struct atomic_uint32_t {
-  typedef u32 Type;
-  volatile Type val_dont_use;
-};
-
-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;
+template<typename T>
+struct atomic {
+  typedef T Type;
+  volatile Type ALIGNED(sizeof(Type)) val_dont_use;
 };
 
-struct atomic_uintptr_t {
-  typedef uptr Type;
-  volatile Type val_dont_use;
-};
+typedef atomic<u8> atomic_uint8_t;
+typedef atomic<u16> atomic_uint16_t;
+typedef atomic<s32> atomic_sint32_t;
+typedef atomic<u32> atomic_uint32_t;
+typedef atomic<u64> atomic_uint64_t;
+typedef atomic<uptr> atomic_uintptr_t;
 
 }  // namespace __sanitizer
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44246.223500.patch
Type: text/x-patch
Size: 1250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191007/967b5f44/attachment.bin>


More information about the llvm-commits mailing list