[clang] [Clang] Implement the core language parts of P2786 - Trivial relocation (PR #127636)

via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 24 07:55:34 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.
----------------
cor3ntin wrote:

I'd like a built in that has the standard behavior.
I think there is an interesting question as to whether the existing builtin should be modified to return true
if either a type is trivial_abi or relocatable by the standard. I think this would make sense

https://github.com/llvm/llvm-project/pull/127636


More information about the cfe-commits mailing list