This is an archive of the discontinued LLVM Phabricator instance.

P1144 "Trivially relocatable" (2/3): explicit warrants for std library types

Authored by Mordante on Jun 20 2019, 12:36 PM.


Group Reviewers
Restricted Project

Part 0/3 is D50119: it adds __has_extension(__is_trivially_relocatable) to the compiler.
Part 1/3 is D61761: it implements the library traits and algorithms mandated by P1144.
Part 2/3 is D63620: it implements Quality-of-Implementation features to warrant certain std library types as "trivially relocatable."
Part 3/3 is D67524: it implements Quality-of-Implementation features to optimize certain std library functions for better performance on types that have been warranted "trivially relocatable."

This patch has no ABI implications (or if it does, that's a bug, please tell me about it). This patch doesn't do any special optimizations (e.g. to std::vector::reserve); those will come in part 3/3.


  • how should the new tests be guarded so that they don't fail on compilers lacking __has_extension(__is_trivially_relocatable)?
  • I made std::vector<bool>::__storage_pointer a public member; I don't know if this is acceptable.
  • The code for many containers would be shorter if we use [[maybe_trivially_relocatable]] instead of [[trivially_relocatable(all my members are trivially relocatable)]]. P1144 discusses, but doesn't propose, [[maybe_trivially_relocatable]]. D50119 does implement it.
  • explicit warrants for stack, queue, and priority_queue (which would not be needed if those types could follow the Rule of Zero; see D61139 for details)

Diff Detail

Event Timeline

Quuxplusone edited the summary of this revision. (Show Details)

Rebase on the latest version of D61761: Hide is_trivially_relocatable behind a __libcpp_ prefix.

Rebase on master/D61761, and finally implement conditionally trivial relocatability for stack, queue, and priority_queue.

Rebased on master.

Migrate to the monorepo.

Herald added a project: Restricted Project. · View Herald TranscriptJan 1 2020, 4:51 PM
ldionne added a reviewer: Restricted Project.Nov 2 2020, 2:26 PM
Mordante commandeered this revision.Nov 1 2023, 10:52 AM
Mordante added a reviewer: Quuxplusone.
Mordante added a subscriber: Mordante.

Since P1144 is still in flight in WG21 abandoning this patch for now. When the paper is approved we can look it up again and see how outdated it is.

Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2023, 10:52 AM
Mordante abandoned this revision.Nov 1 2023, 10:53 AM