[clang] [clang] Implement a bitwise_copyable builtin type trait. (PR #86512)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Tue May 28 09:21:26 PDT 2024
================
@@ -1120,6 +1120,14 @@ class QualType {
/// Return true if this is a trivially copyable type (C++0x [basic.types]p9)
bool isTriviallyCopyableType(const ASTContext &Context) const;
+ /// Return true if the type is safe to bitwise copy by memcpy.
+ ///
+ /// This is an extension in clang: bitwise clonable types act as trivially
----------------
ilya-biryukov wrote:
We should update the documentation to talk about the things that we are actually checking now, i.e. that `memcpy` will succeed and have a valid object representation, even if the lifetime is not formally started.
Mentioning when it's not the case would also be helpful:
- memcpy fails, e.g. sanitizers that add padding with poison.
- (potentially) types with ObjC lifetimes.
https://github.com/llvm/llvm-project/pull/86512
More information about the cfe-commits
mailing list