[all-commits] [llvm/llvm-project] ba3864: [libc] Added checks to src and dest types in bit_cast

Mikhail R. Gadelha via All-commits all-commits at lists.llvm.org
Thu Apr 20 16:38:40 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ba38640b9901d239e32e12c6569f7364d00af922
      https://github.com/llvm/llvm-project/commit/ba38640b9901d239e32e12c6569f7364d00af922
  Author: Mikhail R. Gadelha <mikhail at igalia.com>
  Date:   2023-04-20 (Thu, 20 Apr 2023)

  Changed paths:
    M libc/src/__support/CPP/bit.h
    M libc/src/__support/CPP/type_traits.h

  Log Message:
  -----------
  [libc] Added checks to src and dest types in bit_cast

This patch adds assertions to prevent the compilation when we try to
bit cast a type that is not trivially copyable when using
__builtin_bit_cast, or when we try to bit cast a type that is not
trivially copyable and trivially constructable when using memcpy.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D148739




More information about the All-commits mailing list