[compiler-rt] r330376 - [sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into a template. NFC.

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 20 00:38:44 PDT 2018


This broke the Windows build, see
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10130

I've reverted in r330395.

On Fri, Apr 20, 2018 at 1:00 AM, Kuba Mracek via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: kuba.brecka
> Date: Thu Apr 19 16:00:43 2018
> New Revision: 330376
>
> URL: http://llvm.org/viewvc/llvm-project?rev=330376&view=rev
> Log:
> [sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into a template. NFC.
>
> Differential Revision: https://reviews.llvm.org/D44246
>
>
> Modified:
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic.h
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic.h?rev=330376&r1=330375&r2=330376&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic.h (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic.h Thu Apr 19 16:00:43 2018
> @@ -27,36 +27,18 @@ enum memory_order {
>    memory_order_seq_cst = 1 << 5
>  };
>
> -struct atomic_uint8_t {
> -  typedef u8 Type;
> -  volatile Type val_dont_use;
> +template<typename T>
> +struct atomic {
> +  typedef T Type;
> +  volatile Type ALIGNED(sizeof(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;
> -};
> -
> -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
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list