[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
================
@@ -2749,6 +2749,17 @@ bool QualType::isTriviallyCopyableType(const ASTContext &Context) const {
/*IsCopyConstructible=*/false);
}
+bool QualType::isBitwiseCloneableType(const ASTContext & Context) const {
+ if (const auto *RD = getCanonicalType()->getAsCXXRecordDecl()) {
----------------
ilya-biryukov wrote:
Should we also disallow the objects that return true for `hasNonTrivialObjCLifetime`?
That's the part of the `is_trivially_copyable` that seems relevant. I don't have a good understanding of ObjC, so I'd rather lean on the safe side here. (I.e. maybe there are low-level ways to update the reference counters after `memcpy`, I don't really know. But assuming there aren't, I'd rather lean on the side of returning false for this trait)
https://github.com/llvm/llvm-project/pull/86512
More information about the cfe-commits
mailing list