[all-commits] [llvm/llvm-project] f6c1e6: [clang] Implement a __is_bitwise_cloneable builtin...

Haojian Wu via All-commits all-commits at lists.llvm.org
Wed Jun 5 22:28:23 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f6c1e65ddfa9e1a07919104be543a1f9eccbb519
      https://github.com/llvm/llvm-project/commit/f6c1e65ddfa9e1a07919104be543a1f9eccbb519
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2024-06-06 (Thu, 06 Jun 2024)

  Changed paths:
    M clang/docs/LanguageExtensions.rst
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/Type.h
    M clang/include/clang/Basic/TokenKinds.def
    M clang/lib/AST/Type.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    A clang/test/SemaCXX/builtin-is-bitwise-cloneable-fsanitize.cpp
    A clang/test/SemaCXX/builtin-is-bitwise-cloneable.cpp
    M clang/test/SemaObjCXX/arc-type-traits.mm

  Log Message:
  -----------
  [clang] Implement a __is_bitwise_cloneable builtin type trait. (#86512)

This patch implements a `__is_bitwise_cloneable` builtin in clang.

The builtin is used as a guard to check a type can be safely bitwise
copied by memcpy. It's functionally similar to
`__is_trivially_copyable`, but covers a wider range of types (e.g.
classes with virtual functions). The compiler guarantees that after
copy, the destination object has the same object representations as the
source object. And it is up to user to guarantee that program semantic
constraints are satisfied.

Context:
https://discourse.llvm.org/t/extension-for-creating-objects-via-memcpy



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list