[PATCH] D92361: [trivial-abi] Support types without a copy or move constructor.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 00:11:54 PST 2020


rjmccall added a comment.

There is no such thing as an object "teleporting" in C++.  Objects are always observed in memory with a specific address.  When an argument is passed in registers, its address can be observed to be different on both sides, and that is not permitted; there must be some operation that creates the object at the new address and destroys it at the old.  That operation is a destructive move (which I certainly did not originate as a term for this), or what your proposal calls a relocation (which may be a more palatable term for the C++ committee).

As I think I've mentioned before, the only conceptual difference between an *accepted* `trivial_abi` attribute and your proposed attribute is that your attribute intentionally restricts when destructive moves can be performed so that adopting it doesn't constitute an ABI break.  Your trait should certainly consider a `trivial_abi` type to be trivially relocatable.

I do think that understanding how representation choices restrict types and their operations is important to determining the right design here.  I do understand that you would prefer a more unconditional, directive-like approach, but that is not the direction we have taken with `trivial_abi`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92361/new/

https://reviews.llvm.org/D92361



More information about the cfe-commits mailing list