[libcxx-commits] [PATCH] D63620: P1144 "Trivially relocatable" (2/3): explicit warrants for std library types

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 20 12:37:04 PDT 2019


Quuxplusone created this revision.
Quuxplusone added a reviewer: ldionne.
Herald added subscribers: libcxx-commits, jfb, dexonsmith, christof, krytarowski.

Part 1/3 is D61761 <https://reviews.llvm.org/D61761>.

This patch implements Quality-of-Implementation features so that the compiler can recognize certain `std` library types as "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.

D50119 <https://reviews.llvm.org/D50119> adds `__has_extension(__is_trivially_relocatable)` to the compiler.

TODO:

- 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_if(all my members are trivially relocatable)]]`. P1144 <https://reviews.llvm.org/P1144> discusses, but doesn't propose, `[[maybe_trivially_relocatable]]`.
- explicit warrants for `stack`, `queue`, and `priority_queue`


Repository:
  rCXX libc++

https://reviews.llvm.org/D63620

Files:
  include/__bit_reference
  include/__config
  include/__hash_table
  include/__locale
  include/__mutex_base
  include/bitset
  include/deque
  include/exception
  include/forward_list
  include/future
  include/memory
  include/optional
  include/shared_mutex
  include/string
  include/thread
  include/unordered_map
  include/unordered_set
  include/variant
  include/vector
  test/libcxx/containers/sequences/deque/trivially_relocatable.pass.cpp
  test/libcxx/containers/sequences/vector/trivially_relocatable.pass.cpp
  test/libcxx/containers/unord/unord.map/trivially_relocatable.pass.cpp
  test/libcxx/containers/unord/unord.set/trivially_relocatable.pass.cpp
  test/libcxx/strings/basic.string/trivially_relocatable.pass.cpp
  test/libcxx/type_traits/is_trivially_relocatable.pass.cpp
  test/libcxx/utilities/memory/util.smartptr/trivially_relocatable.pass.cpp
  test/libcxx/utilities/memory/util.smartptr/trivially_relocatable_with_deleter.pass.cpp
  test/libcxx/utilities/optional/optional.object/trivial_copy_move_ABI.pass.cpp
  test/libcxx/utilities/tuple/tuple.tuple/trivial_copy_move_ABI.pass.cpp
  test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
  test/libcxx/utilities/variant/variant.variant/trivial_copy_move_ABI.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63620.205875.patch
Type: text/x-patch
Size: 101356 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190620/687df83e/attachment-0001.bin>


More information about the libcxx-commits mailing list