[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 16 09:33:02 PDT 2024


AaronBallman wrote:

> > We (users & implementers) have all collectively identified trivial relocatability as an important optimization for vector-like containers, and we're all looking for a solution to that. It feels like this attempt to standardize this type trait is getting in the way of our collective ability to add vendor extensions that were not necessarily intended to become standards-track proposals.
> 
> Since people are asking for these semantics in Clang's vendor extension, how would people feel about proceeding in this direction for now, and adding a second type trait, named something like `__is_cpp_trivially_relocatable(T)`, for the P2786 version?

Our naming convention is generally `__is_xxx` mapping to `std::is_xxx`, so this trait should not be changed to have different semantics from what C++ uses for the type trait. Until WG21 finalizes the type trait, I do not think we should do *anything* to `__is_trivially_relocatable` and it's not clear we'll need a new type trait. I think this PR is in a holding pattern until we know what the standard solution will be -- once we have that information, we can make an informed choice as to how to move forward. (If the committee drops the ball, we can cross that bridge if we come to it.)

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


More information about the cfe-commits mailing list