[clang] [Clang] Implement the core language parts of P2786 - Trivial relocation (PR #127636)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 25 06:16:38 PST 2025
================
@@ -1826,6 +1827,12 @@ The following type trait primitives are supported by Clang. Those traits marked
functionally equivalent to copying the underlying bytes and then dropping the
source object on the floor. This is true of trivial types and types which
were made trivially relocatable via the ``clang::trivial_abi`` attribute.
+* ``__builtin_is_cpp_trivially_relocatable`` (C++): Returns true if an object
+ is trivially relocatable, as defined by the C++26 standard [meta.unary.prop].
+ Note that the caller code should ensure that if the object is polymorphic,
+ the dynamic type is of the most derived type.
----------------
erichkeane wrote:
Corentin is right. Any attempt we make to modify `__is_trivially_relocatable` is going to either be non-standard or break `[[clang::trivial_abi]]`.
SO, we'd want to choose which we'd want to do. I very strongly don't believe we can be non-standard here, this is an important standardized feature, and `clang::trivial_abi` isn't any better.
I am ok with us modifying `clang::trivial_abi` over a number of releases(like 2-3 releases!) to make it be the same as the standards feature, but only if we can come to an agreement with the folks who are already using it.
SO in short, I think combining these builtins right now is untenable. Long-term, it is possible but only if we are willing/able to significantly break `clang::trivial_abi`.
https://github.com/llvm/llvm-project/pull/127636
More information about the cfe-commits
mailing list