Unverified Commit f6c1e65d authored by Haojian Wu's avatar Haojian Wu Committed by GitHub
Browse files

[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
parent 68413219
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment