aboutsummaryrefslogtreecommitdiff
path: root/libcxx/docs
AgeCommit message (Collapse)AuthorFilesLines
21 hours[libc++] Introduce _LIBCPP_COMPRESSED_ELEMENT (#134253)Nikolas Klauser1-1/+7
We have multiple classes with an empty base optimization that contains just a single type. This patch introduces `_LIBCPP_COMPRESSED_ELEMENT` to refactor these classes to avoid having them essentially twice, reducing the amount of code significantly.
43 hoursRevert "[libc++] Optimize __hash_table::erase(iterator, iterator) (#1… ↵Aiden Grossman1-1/+0
(#158769) …52471)" This reverts commit e4eccd6a3c2415c10bb8217c247d7aca76cc9ad5. This was causing ASan failures in some situations involving unordered multimap containers. Details and a reproducer were posted on the original PR (#152471).
4 days[libc++] Add documentation for the new comment-triggered benchmarking bot ↵Louis Dionne1-0/+10
(#158167) The new benchmarking bot is experimental and is very rough on the edges.
10 days[libc++] Start tracking Github issues in status pages (#149833)Louis Dionne8-1608/+1608
This patch adds another row to the Status pages that cross-references the Github issue. It also ensures that the synchronization script takes that new row into account. This should make it easier to find out about the detailed status of a paper from the status pages by clicking on the link and being taken directly to its associated Github issue. I expect that this should remove the need for many "Notes" which simply duplicate the information of which parts of a paper are implemented: instead we can list that the implementation is partial and users can click on the Github issue to see what's implemented.
10 days[libc++] Update utilities to compare benchmarks (#157556)Louis Dionne1-11/+30
This patch replaces the previous `libcxx-compare-benchmarks` wrapper by a new `compare-benchmarks` script which works with LNT-compatible data. This allows comparing benchmark results across libc++ microbenchmarks, SPEC, and anything else that would produce LNT-compatible data. It also adds a simple script to consolidate LNT benchmark output into a single file, simplifying the process of doing A/B runs locally. The simplest way to do this doesn't require creating two build directories after this patch anymore. It also adds the ability to produce either a standalone HTML chart or a plain text output for diffing results locally when prototyping changes. Example text output of the new tool: ``` Benchmark Baseline Candidate Difference % Difference ----------------------------------- ---------- ----------- ------------ -------------- BM_join_view_deques/0 8.11 8.16 0.05 0.63 BM_join_view_deques/1 13.56 13.79 0.23 1.69 BM_join_view_deques/1024 6606.51 7011.34 404.83 6.13 BM_join_view_deques/2 17.99 19.92 1.93 10.72 BM_join_view_deques/4000 27655.58 29864.72 2209.14 7.99 BM_join_view_deques/4096 26218.07 30520.13 4302.05 16.41 BM_join_view_deques/512 3231.66 2832.47 -399.19 -12.35 BM_join_view_deques/5500 47144.82 42207.41 -4937.42 -10.47 BM_join_view_deques/64 247.23 262.66 15.43 6.24 BM_join_view_deques/64000 756221.63 511247.48 -244974.15 -32.39 BM_join_view_deques/65536 537110.91 560241.61 23130.70 4.31 BM_join_view_deques/70000 815739.07 616181.34 -199557.73 -24.46 BM_join_view_out_vectors/0 0.93 0.93 0.00 0.07 BM_join_view_out_vectors/1 3.11 3.14 0.03 0.82 BM_join_view_out_vectors/1024 3090.92 3563.29 472.37 15.28 BM_join_view_out_vectors/2 5.52 5.56 0.04 0.64 BM_join_view_out_vectors/4000 9887.21 9774.40 -112.82 -1.14 BM_join_view_out_vectors/4096 10158.78 10190.44 31.66 0.31 BM_join_view_out_vectors/512 1218.68 1209.59 -9.09 -0.75 BM_join_view_out_vectors/5500 13559.23 13676.06 116.84 0.86 BM_join_view_out_vectors/64 158.95 157.91 -1.04 -0.65 BM_join_view_out_vectors/64000 178514.73 226520.97 48006.24 26.89 BM_join_view_out_vectors/65536 184639.37 207180.35 22540.98 12.21 BM_join_view_out_vectors/70000 235006.69 213886.93 -21119.77 -8.99 ```
2025-09-04[libc++][NFC] Use llvm.org/PR to link to bug reports (#156288)Nikolas Klauser4-8/+7
We've built up quite a few links directly to github within the code base. We should instead use `llvm.org/PR<issue-number>` to link to bugs, since that is resilient to the bug tracker changing in the future. This is especially relevant for tests linking to bugs, since they will probably be there for decades to come. A nice side effect is that these links are significantly shorter than the GH links, making them much less of an eyesore. This patch also replaces a few links that linked to the old bugzilla instance on llvm.org.
2025-09-04[libc++] Split ABI flag for removing iterator bases and removing the second ↵Nikolas Klauser2-0/+12
member in reverse_iterator (#143079) Currently `_LIBCPP_NO_ITERATOR_BASES` controls both whether specific classes derive from `iterator` and whether `reverse_iterator` has a second member variable. These two changes are orthogonal though, and one can be applied in all langauge modes while the other change is only conforming for C++17 and later.
2025-09-03[libc++][ranges] LWG4083: `views::as_rvalue` should reject non-input ranges ↵Hristo Hristov1-1/+1
(#155156) Fixes #105351 # References: - https://wg21.link/LWG4083 - https://wg21.link/range.as.rvalue.overview
2025-09-03[libc++] Optimize {map,set}::insert(InputIterator, InputIterator) (#154703)Nikolas Klauser1-2/+3
``` ---------------------------------------------------------------------------------------------------------------------------- Benchmark old new ---------------------------------------------------------------------------------------------------------------------------- std::map<int, int>::ctor(iterator, iterator) (unsorted sequence)/0 14.2 ns 14.8 ns std::map<int, int>::ctor(iterator, iterator) (unsorted sequence)/32 519 ns 404 ns std::map<int, int>::ctor(iterator, iterator) (unsorted sequence)/1024 52460 ns 36242 ns std::map<int, int>::ctor(iterator, iterator) (unsorted sequence)/8192 724222 ns 706496 ns std::map<int, int>::ctor(iterator, iterator) (sorted sequence)/0 14.2 ns 14.7 ns std::map<int, int>::ctor(iterator, iterator) (sorted sequence)/32 429 ns 349 ns std::map<int, int>::ctor(iterator, iterator) (sorted sequence)/1024 23601 ns 14734 ns std::map<int, int>::ctor(iterator, iterator) (sorted sequence)/8192 267753 ns 112155 ns std::map<int, int>::insert(iterator, iterator) (all new keys)/0 434 ns 448 ns std::map<int, int>::insert(iterator, iterator) (all new keys)/32 950 ns 963 ns std::map<int, int>::insert(iterator, iterator) (all new keys)/1024 27205 ns 25344 ns std::map<int, int>::insert(iterator, iterator) (all new keys)/8192 294248 ns 280713 ns std::map<int, int>::insert(iterator, iterator) (half new keys)/0 435 ns 449 ns std::map<int, int>::insert(iterator, iterator) (half new keys)/32 771 ns 706 ns std::map<int, int>::insert(iterator, iterator) (half new keys)/1024 30841 ns 17495 ns std::map<int, int>::insert(iterator, iterator) (half new keys)/8192 468807 ns 285847 ns std::map<int, int>::insert(iterator, iterator) (product_iterator from same type)/0 449 ns 453 ns std::map<int, int>::insert(iterator, iterator) (product_iterator from same type)/32 1021 ns 932 ns std::map<int, int>::insert(iterator, iterator) (product_iterator from same type)/1024 29796 ns 19518 ns std::map<int, int>::insert(iterator, iterator) (product_iterator from same type)/8192 345688 ns 153966 ns std::map<int, int>::insert(iterator, iterator) (product_iterator from zip_view)/0 449 ns 450 ns std::map<int, int>::insert(iterator, iterator) (product_iterator from zip_view)/32 1026 ns 807 ns std::map<int, int>::insert(iterator, iterator) (product_iterator from zip_view)/1024 31632 ns 15573 ns std::map<int, int>::insert(iterator, iterator) (product_iterator from zip_view)/8192 303024 ns 128946 ns std::map<int, int>::erase(iterator, iterator) (erase half the container)/0 447 ns 452 ns std::map<int, int>::erase(iterator, iterator) (erase half the container)/32 687 ns 710 ns std::map<int, int>::erase(iterator, iterator) (erase half the container)/1024 8604 ns 8581 ns std::map<int, int>::erase(iterator, iterator) (erase half the container)/8192 65693 ns 67406 ns std::map<std::string, int>::ctor(iterator, iterator) (unsorted sequence)/0 15.0 ns 15.0 ns std::map<std::string, int>::ctor(iterator, iterator) (unsorted sequence)/32 2781 ns 1845 ns std::map<std::string, int>::ctor(iterator, iterator) (unsorted sequence)/1024 187999 ns 182103 ns std::map<std::string, int>::ctor(iterator, iterator) (unsorted sequence)/8192 2937242 ns 2934912 ns std::map<std::string, int>::ctor(iterator, iterator) (sorted sequence)/0 15.0 ns 15.2 ns std::map<std::string, int>::ctor(iterator, iterator) (sorted sequence)/32 1326 ns 2462 ns std::map<std::string, int>::ctor(iterator, iterator) (sorted sequence)/1024 81778 ns 72193 ns std::map<std::string, int>::ctor(iterator, iterator) (sorted sequence)/8192 1177292 ns 669152 ns std::map<std::string, int>::insert(iterator, iterator) (all new keys)/0 439 ns 454 ns std::map<std::string, int>::insert(iterator, iterator) (all new keys)/32 2483 ns 2465 ns std::map<std::string, int>::insert(iterator, iterator) (all new keys)/1024 187614 ns 188072 ns std::map<std::string, int>::insert(iterator, iterator) (all new keys)/8192 1654675 ns 1706603 ns std::map<std::string, int>::insert(iterator, iterator) (half new keys)/0 437 ns 452 ns std::map<std::string, int>::insert(iterator, iterator) (half new keys)/32 1836 ns 1820 ns std::map<std::string, int>::insert(iterator, iterator) (half new keys)/1024 114885 ns 121865 ns std::map<std::string, int>::insert(iterator, iterator) (half new keys)/8192 1151960 ns 1197318 ns std::map<std::string, int>::insert(iterator, iterator) (product_iterator from same type)/0 438 ns 455 ns std::map<std::string, int>::insert(iterator, iterator) (product_iterator from same type)/32 1599 ns 1614 ns std::map<std::string, int>::insert(iterator, iterator) (product_iterator from same type)/1024 95935 ns 82159 ns std::map<std::string, int>::insert(iterator, iterator) (product_iterator from same type)/8192 776480 ns 941043 ns std::map<std::string, int>::insert(iterator, iterator) (product_iterator from zip_view)/0 435 ns 462 ns std::map<std::string, int>::insert(iterator, iterator) (product_iterator from zip_view)/32 1723 ns 1550 ns std::map<std::string, int>::insert(iterator, iterator) (product_iterator from zip_view)/1024 107096 ns 92850 ns std::map<std::string, int>::insert(iterator, iterator) (product_iterator from zip_view)/8192 893976 ns 775046 ns std::map<std::string, int>::erase(iterator, iterator) (erase half the container)/0 436 ns 453 ns std::map<std::string, int>::erase(iterator, iterator) (erase half the container)/32 775 ns 824 ns std::map<std::string, int>::erase(iterator, iterator) (erase half the container)/1024 20241 ns 20454 ns std::map<std::string, int>::erase(iterator, iterator) (erase half the container)/8192 139038 ns 138032 ns std::set<int>::ctor(iterator, iterator) (unsorted sequence)/0 14.8 ns 14.7 ns std::set<int>::ctor(iterator, iterator) (unsorted sequence)/32 468 ns 426 ns std::set<int>::ctor(iterator, iterator) (unsorted sequence)/1024 54289 ns 39028 ns std::set<int>::ctor(iterator, iterator) (unsorted sequence)/8192 738438 ns 695720 ns std::set<int>::ctor(iterator, iterator) (sorted sequence)/0 14.7 ns 14.6 ns std::set<int>::ctor(iterator, iterator) (sorted sequence)/32 478 ns 391 ns std::set<int>::ctor(iterator, iterator) (sorted sequence)/1024 24017 ns 13905 ns std::set<int>::ctor(iterator, iterator) (sorted sequence)/8192 267862 ns 111378 ns std::set<int>::insert(iterator, iterator) (all new keys)/0 458 ns 450 ns std::set<int>::insert(iterator, iterator) (all new keys)/32 1066 ns 956 ns std::set<int>::insert(iterator, iterator) (all new keys)/1024 29190 ns 25212 ns std::set<int>::insert(iterator, iterator) (all new keys)/8192 320441 ns 279602 ns std::set<int>::insert(iterator, iterator) (half new keys)/0 454 ns 453 ns std::set<int>::insert(iterator, iterator) (half new keys)/32 816 ns 709 ns std::set<int>::insert(iterator, iterator) (half new keys)/1024 32072 ns 17074 ns std::set<int>::insert(iterator, iterator) (half new keys)/8192 403386 ns 286202 ns std::set<int>::erase(iterator, iterator) (erase half the container)/0 451 ns 452 ns std::set<int>::erase(iterator, iterator) (erase half the container)/32 710 ns 703 ns std::set<int>::erase(iterator, iterator) (erase half the container)/1024 8261 ns 8499 ns std::set<int>::erase(iterator, iterator) (erase half the container)/8192 64466 ns 67343 ns std::set<std::string>::ctor(iterator, iterator) (unsorted sequence)/0 15.2 ns 15.0 ns std::set<std::string>::ctor(iterator, iterator) (unsorted sequence)/32 3069 ns 3005 ns std::set<std::string>::ctor(iterator, iterator) (unsorted sequence)/1024 189552 ns 180933 ns std::set<std::string>::ctor(iterator, iterator) (unsorted sequence)/8192 2887579 ns 2691678 ns std::set<std::string>::ctor(iterator, iterator) (sorted sequence)/0 15.1 ns 14.9 ns std::set<std::string>::ctor(iterator, iterator) (sorted sequence)/32 2611 ns 2514 ns std::set<std::string>::ctor(iterator, iterator) (sorted sequence)/1024 91581 ns 78727 ns std::set<std::string>::ctor(iterator, iterator) (sorted sequence)/8192 1192640 ns 1158959 ns std::set<std::string>::insert(iterator, iterator) (all new keys)/0 452 ns 457 ns std::set<std::string>::insert(iterator, iterator) (all new keys)/32 2530 ns 2544 ns std::set<std::string>::insert(iterator, iterator) (all new keys)/1024 195352 ns 179614 ns std::set<std::string>::insert(iterator, iterator) (all new keys)/8192 1737890 ns 1749615 ns std::set<std::string>::insert(iterator, iterator) (half new keys)/0 451 ns 454 ns std::set<std::string>::insert(iterator, iterator) (half new keys)/32 1949 ns 1766 ns std::set<std::string>::insert(iterator, iterator) (half new keys)/1024 128853 ns 109467 ns std::set<std::string>::insert(iterator, iterator) (half new keys)/8192 1233077 ns 1177289 ns std::set<std::string>::erase(iterator, iterator) (erase half the container)/0 450 ns 451 ns std::set<std::string>::erase(iterator, iterator) (erase half the container)/32 809 ns 812 ns std::set<std::string>::erase(iterator, iterator) (erase half the container)/1024 21736 ns 21922 ns std::set<std::string>::erase(iterator, iterator) (erase half the container)/8192 135884 ns 133228 ns ``` Fixes #154650
2025-08-29[libc++] Optimize map::insert_or_assign (#155816)Nikolas Klauser1-0/+1
`__emplace_unique` uses `__find_equal`, which can be significantly faster than `lower_bound`. As a nice side-effect, this also changes the implementation to the "naive" implementation of trying `insert` first, and if that fails assign instead. This also matches the `insert_or_assign` overloads with a hint. ``` Zen 2: -------------------------------------------------------------------------------------------------------- Benchmark old new -------------------------------------------------------------------------------------------------------- std::map<int, int>::insert_or_assign(key, value) (already present)/0 1.62 ns 1.53 ns std::map<int, int>::insert_or_assign(key, value) (already present)/32 5.78 ns 5.99 ns std::map<int, int>::insert_or_assign(key, value) (already present)/1024 21.5 ns 15.4 ns std::map<int, int>::insert_or_assign(key, value) (already present)/8192 26.2 ns 20.5 ns std::map<int, int>::insert_or_assign(key, value) (new value)/0 22.5 ns 21.1 ns std::map<int, int>::insert_or_assign(key, value) (new value)/32 42.9 ns 28.4 ns std::map<int, int>::insert_or_assign(key, value) (new value)/1024 118 ns 92.0 ns std::map<int, int>::insert_or_assign(key, value) (new value)/8192 227 ns 173 ns std::map<std::string, int>::insert_or_assign(key, value) (already present)/0 13.2 ns 18.9 ns std::map<std::string, int>::insert_or_assign(key, value) (already present)/32 65.6 ns 39.0 ns std::map<std::string, int>::insert_or_assign(key, value) (already present)/1024 127 ns 64.4 ns std::map<std::string, int>::insert_or_assign(key, value) (already present)/8192 134 ns 71.4 ns std::map<std::string, int>::insert_or_assign(key, value) (new value)/0 45.6 ns 37.3 ns std::map<std::string, int>::insert_or_assign(key, value) (new value)/32 142 ns 93.3 ns std::map<std::string, int>::insert_or_assign(key, value) (new value)/1024 288 ns 147 ns std::map<std::string, int>::insert_or_assign(key, value) (new value)/8192 368 ns 182 ns Apple M4: -------------------------------------------------------------------------------------------------------- Benchmark old new -------------------------------------------------------------------------------------------------------- std::map<int, int>::insert_or_assign(key, value) (already present)/0 0.784 ns 0.740 ns std::map<int, int>::insert_or_assign(key, value) (already present)/32 2.52 ns 1.77 ns std::map<int, int>::insert_or_assign(key, value) (already present)/1024 8.72 ns 4.06 ns std::map<int, int>::insert_or_assign(key, value) (already present)/8192 10.6 ns 3.98 ns std::map<int, int>::insert_or_assign(key, value) (new value)/0 17.3 ns 17.2 ns std::map<int, int>::insert_or_assign(key, value) (new value)/32 22.5 ns 19.3 ns std::map<int, int>::insert_or_assign(key, value) (new value)/1024 56.8 ns 33.5 ns std::map<int, int>::insert_or_assign(key, value) (new value)/8192 88.2 ns 41.0 ns std::map<std::string, int>::insert_or_assign(key, value) (already present)/0 16.6 ns 11.8 ns std::map<std::string, int>::insert_or_assign(key, value) (already present)/32 13.7 ns 30.7 ns std::map<std::string, int>::insert_or_assign(key, value) (already present)/1024 46.7 ns 49.1 ns std::map<std::string, int>::insert_or_assign(key, value) (already present)/8192 41.9 ns 76.9 ns std::map<std::string, int>::insert_or_assign(key, value) (new value)/0 40.0 ns 40.5 ns std::map<std::string, int>::insert_or_assign(key, value) (new value)/32 38.9 ns 40.0 ns std::map<std::string, int>::insert_or_assign(key, value) (new value)/1024 84.9 ns 96.9 ns std::map<std::string, int>::insert_or_assign(key, value) (new value)/8192 166 ns 149 ns ```
2025-08-28[libc++] Stabilize transitive includes for C++23 (#134143)Louis Dionne1-10/+24
Our mechanism to retain transitive includes for backwards compatibility was previously not taking into account C++23: this means that users on C++23 would not get any protection against the removal of transitive includes. This was fine when C++23 was still not used widely and it allowed us to make build time improvements for such "bleeding edge" users. It also didn't take into account the larger topic of providing a backwards compatible set of declarations, which is the real goal of this mechanism. However, now that C++23 is used pretty widely, we should start providing transitive includes backwards compatibility for users of that language mode too. This patch documents that requirement and mentions backwards compatibility of the set of declarations as well, meaning we may also add internal headers in the `_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` blocks going forward. There are no actual changes to the code since we haven't removed transitive includes since the last release. However, starting now, we should guard any removal of transitive includes behind #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23 instead of #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2025-08-27[libc++] Optimize ofstream::write (#123337)Nikolas Klauser1-0/+3
``` ---------------------------- Benchmark old new ---------------------------- bm_write 1382 ns 521 ns ```
2025-08-26[libc++][NFC] Wrap lines in ReleaseNotes/22.rst (#155359)Nikolas Klauser1-3/+9
Some of the lines in `ReleaseNotes/22.rst` are (significantly) longer than our usual 120 column limit. This wraps all lines in the file so they are never more than our usual limit.
2025-08-26[libc++] Remove a few incorrect _LIBCPP_EXPORTED_FROM_ABI annotations (#132602)Nikolas Klauser1-1/+3
This has two benefits: - It is less likely that the macro will be copy-pasted around when unnecessary - We can drop `_LIBCPP_HIDE_FROM_ABI` from any member functions once we are able to make `_LIBCPP_HIDE_FROM_ABI` the default within libc++
2025-08-26[libc++] Add a release note about multi{map,set}::find not returning the ↵Nikolas Klauser1-0/+2
first element anymore (#155252) We've modified the algorithm of `__tree::find` in #152370, which can change the return value. Since we're always returned the lower bound before some users started relying on it. This patch adds a release note so users are aware that this might break their code.
2025-08-25[libc++] Optimize __hash_table::erase(iterator, iterator) (#152471)Nikolas Klauser1-0/+1
Instead of just calling the single element `erase` on every element of the range, we can combine some of the operations in a custom implementation. Specifically, we don't need to search for the previous node or re-link the list every iteration. Removing this unnecessary work results in some nice performance improvements: ``` ----------------------------------------------------------------------------------------------------------------------- Benchmark old new ----------------------------------------------------------------------------------------------------------------------- std::unordered_set<int>::erase(iterator, iterator) (erase half the container)/0 457 ns 459 ns std::unordered_set<int>::erase(iterator, iterator) (erase half the container)/32 995 ns 626 ns std::unordered_set<int>::erase(iterator, iterator) (erase half the container)/1024 18196 ns 7995 ns std::unordered_set<int>::erase(iterator, iterator) (erase half the container)/8192 124722 ns 70125 ns std::unordered_set<std::string>::erase(iterator, iterator) (erase half the container)/0 456 ns 461 ns std::unordered_set<std::string>::erase(iterator, iterator) (erase half the container)/32 1183 ns 769 ns std::unordered_set<std::string>::erase(iterator, iterator) (erase half the container)/1024 27827 ns 18614 ns std::unordered_set<std::string>::erase(iterator, iterator) (erase half the container)/8192 266681 ns 226107 ns std::unordered_map<int, int>::erase(iterator, iterator) (erase half the container)/0 455 ns 462 ns std::unordered_map<int, int>::erase(iterator, iterator) (erase half the container)/32 996 ns 659 ns std::unordered_map<int, int>::erase(iterator, iterator) (erase half the container)/1024 15963 ns 8108 ns std::unordered_map<int, int>::erase(iterator, iterator) (erase half the container)/8192 136493 ns 71848 ns std::unordered_multiset<int>::erase(iterator, iterator) (erase half the container)/0 454 ns 455 ns std::unordered_multiset<int>::erase(iterator, iterator) (erase half the container)/32 985 ns 703 ns std::unordered_multiset<int>::erase(iterator, iterator) (erase half the container)/1024 16277 ns 9085 ns std::unordered_multiset<int>::erase(iterator, iterator) (erase half the container)/8192 125736 ns 82710 ns std::unordered_multimap<int, int>::erase(iterator, iterator) (erase half the container)/0 457 ns 454 ns std::unordered_multimap<int, int>::erase(iterator, iterator) (erase half the container)/32 1091 ns 646 ns std::unordered_multimap<int, int>::erase(iterator, iterator) (erase half the container)/1024 17784 ns 7664 ns std::unordered_multimap<int, int>::erase(iterator, iterator) (erase half the container)/8192 127098 ns 72806 ns ```
2025-08-23[libc++] Fix ABI break introduced by switching to _LIBCPP_COMPRESSED_PAIR ↵Nikolas Klauser1-0/+15
(#154686) LLVM 20 contained an ABI break that can result in the size of `std::unordered_{map,set,multimap,multiset}` and `std::deque` changing when used with an allocator type that is empty and contains a base class that is the same across rebound allocator instantiations (e.g. ``Allocator<int>`` and ``Allocator<char>`` are both empty and contain the same base class). In addition, the layout of a user-defined type that: - contains one of the following containers: `std::unordered_{map,set,multimap,multiset}`, `std::deque`, `std::map`, `std::set`, `std::multimap`, `std::multiset`, `std::list` or `std::vector`, and - passes an empty allocator, comparator or hasher type to that container, and - has a member of that same empty allocator, comparator or hasher type inside the enclosing struct, and - that member is either marked with `[[no_unique_address]]` or optimized out via the EBO (empty base optimization) technique saw its size increase from LLVM 19 to LLVM 20. This was caused by the usage of `[[no_unique_address]]` within some of libc++'s containers in a way that allowed subtle interactions with enclosing objects. This is fixed in LLVM 21 on Clang (returning to the LLVM 19 ABI), however that implies an ABI break from LLVM 20 to LLVM 21. Furthermore, fixing this causes a slight regression to constant evaluation support in `std::unique_ptr`. Specifically, constant evaluation will now fail when the deleter relies on being value-initialized for constant-evaluation admissibility. If a default-initialized deleter can be used during constant evaluation, or if the default constructor is non-trivial, the `unique_ptr` is not affected by this regression. In particular, this regression does not impact any `unique_ptr` using the default deleter. Note that there is currently no way to realistically fix this ABI break on GCC, therefore GCC will remain on the ABI introduced in LLVM 19. That also means that Clang and GCC will have a slightly different ABI for the small subset of types listed above until we are able to apply the same fix we did with Clang on GCC. We fix this regression by surrounding the members of the `_LIBCPP_COMPRESSED_PAIR` with an anonymous struct. This restricts the shifting of empty types to the front of the `_LIBCPP_COMPRESSED_PAIR` instead of throughout the surrounding object. This "frees up" the zero offset to contain another object of the same type, restoring the ability to perform EBO or to elide the storage for a type with `[[no_unique_address]]` in the enclosing (user-defined) struct. Fixes #154146 Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-08-22[libc++] Optimize multi{map,set}::insert(InputIterator, InputIterator) (#152691)Nikolas Klauser1-0/+3
2025-08-20[libc++] Avoid string reallocation in ↵Timothy Choi1-0/+1
`std::filesystem::path::lexically_relative` (#152964) Improves runtime by around 20 to 40%. (1.3x to 1.7x) ``` Benchmark Time CPU Time Old Time New CPU Old CPU New ------------------------------------------------------------------------------------------------------------------------------------------------ BM_LexicallyRelative/small_path/2 -0.2111 -0.2082 229 181 228 180 BM_LexicallyRelative/small_path/4 -0.2579 -0.2550 455 338 452 337 BM_LexicallyRelative/small_path/8 -0.2643 -0.2616 844 621 838 619 BM_LexicallyRelative/small_path/16 -0.2582 -0.2556 1562 1158 1551 1155 BM_LexicallyRelative/small_path/32 -0.2518 -0.2496 3023 2262 3004 2254 BM_LexicallyRelative/small_path/64 -0.2806 -0.2775 6344 4564 6295 4549 BM_LexicallyRelative/small_path/128 -0.2165 -0.2137 11762 9216 11683 9186 BM_LexicallyRelative/small_path/256 -0.2672 -0.2645 24499 17953 24324 17891 BM_LexicallyRelative/large_path/2 -0.3268 -0.3236 426 287 422 285 BM_LexicallyRelative/large_path/4 -0.3274 -0.3248 734 494 729 492 BM_LexicallyRelative/large_path/8 -0.3586 -0.3560 1409 904 1399 901 BM_LexicallyRelative/large_path/16 -0.3978 -0.3951 2764 1665 2743 1659 BM_LexicallyRelative/large_path/32 -0.3934 -0.3908 5323 3229 5283 3218 BM_LexicallyRelative/large_path/64 -0.3629 -0.3605 10340 6587 10265 6564 BM_LexicallyRelative/large_path/128 -0.3450 -0.3423 19379 12694 19233 12649 BM_LexicallyRelative/large_path/256 -0.3097 -0.3054 36293 25052 35943 24965 ``` --------- Co-authored-by: Nikolas Klauser <nikolasklauser@berlin.de>
2025-08-18[libc++] Implement P3168R2: Give optional range support (#149441)William Tran-Viet3-2/+3
Resolves #105430 - Implement all required pieces of P3168R2 - Leverage existing `wrap_iter` and `bounded_iter` classes to implement the `optional` regular and hardened iterator type, respectively - Update documentation to match
2025-08-17[libc++][flat_set] LWG3751, LWG3774 (#153934)Hristo Hristov1-2/+2
- LWG3751: Missing feature macro for `flat_set` Implemented in LLVM21: https://github.com/llvm/llvm-project/commit/7013b51548c0bd2c7e5564735c44506909a2f8dc Closes #105021 - LWG3774: `<flat_set>` should include `<compare>` Implemented in LLVM21: https://github.com/llvm/llvm-project/commit/2f1416bbcde898d65e9762e6ce498bb0121e4610 https://github.com/llvm/llvm-project/blob/684797b6446073b5afd23022449aeecef84c404c/libcxx/include/flat_set#L77 Closes #105036
2025-08-16[libc++][jthread] LWG3788: `jthread::operator=(jthread&&)` postconditions ↵Hristo Hristov1-1/+1
are unimplementable under self-assignment (#153758) Already implemented in LLVM18: [695138c](https://github.com/llvm/llvm-project/commit/695138ca8405779c2b7756cc31d887aa54f56bb8) For details see: https://github.com/llvm/llvm-project/issues/105045#issuecomment-3190674947 Closes #105045
2025-08-15[libc++] Optimize __tree::find and __tree::__erase_unique (#152370)Nikolas Klauser1-0/+2
This patch changes `__tree::find` to return when it has found any equal element instead of the lower bound of the equal elements. For `map` and `set` there is no observable difference, since the keys are unique. However for their `multi` versions this can mean a change in behaviour since it's not longer guaranteed that `find` will return the first element. ``` ------------------------------------------------------------------------------------------ Benchmark old new ------------------------------------------------------------------------------------------ std::map<int, int>::erase(key) (existent)/0 24.4 ns 24.9 ns std::map<int, int>::erase(key) (existent)/32 39.8 ns 32.1 ns std::map<int, int>::erase(key) (existent)/1024 83.8 ns 52.5 ns std::map<int, int>::erase(key) (existent)/8192 91.4 ns 66.4 ns std::map<int, int>::erase(key) (non-existent)/0 0.511 ns 0.328 ns std::map<int, int>::erase(key) (non-existent)/32 9.12 ns 5.62 ns std::map<int, int>::erase(key) (non-existent)/1024 26.6 ns 11.3 ns std::map<int, int>::erase(key) (non-existent)/8192 37.0 ns 16.9 ns std::map<int, int>::find(key) (existent)/0 0.007 ns 0.007 ns std::map<int, int>::find(key) (existent)/32 6.02 ns 4.32 ns std::map<int, int>::find(key) (existent)/1024 13.6 ns 8.35 ns std::map<int, int>::find(key) (existent)/8192 30.3 ns 12.8 ns std::map<int, int>::find(key) (non-existent)/0 0.299 ns 0.545 ns std::map<int, int>::find(key) (non-existent)/32 8.78 ns 4.60 ns std::map<int, int>::find(key) (non-existent)/1024 26.1 ns 21.8 ns std::map<int, int>::find(key) (non-existent)/8192 36.2 ns 27.9 ns std::map<std::string, int>::erase(key) (existent)/0 74.1 ns 76.7 ns std::map<std::string, int>::erase(key) (existent)/32 161 ns 114 ns std::map<std::string, int>::erase(key) (existent)/1024 196 ns 126 ns std::map<std::string, int>::erase(key) (existent)/8192 207 ns 160 ns std::map<std::string, int>::erase(key) (non-existent)/0 0.754 ns 0.328 ns std::map<std::string, int>::erase(key) (non-existent)/32 47.3 ns 40.7 ns std::map<std::string, int>::erase(key) (non-existent)/1024 122 ns 96.1 ns std::map<std::string, int>::erase(key) (non-existent)/8192 168 ns 123 ns std::map<std::string, int>::find(key) (existent)/0 0.059 ns 0.058 ns std::map<std::string, int>::find(key) (existent)/32 54.3 ns 34.6 ns std::map<std::string, int>::find(key) (existent)/1024 125 ns 64.5 ns std::map<std::string, int>::find(key) (existent)/8192 159 ns 79.2 ns std::map<std::string, int>::find(key) (non-existent)/0 0.311 ns 0.299 ns std::map<std::string, int>::find(key) (non-existent)/32 44.0 ns 42.7 ns std::map<std::string, int>::find(key) (non-existent)/1024 120 ns 92.6 ns std::map<std::string, int>::find(key) (non-existent)/8192 189 ns 124 ns std::set<int>::erase(key) (existent)/0 25.1 ns 25.1 ns std::set<int>::erase(key) (existent)/32 42.1 ns 33.1 ns std::set<int>::erase(key) (existent)/1024 73.8 ns 55.5 ns std::set<int>::erase(key) (existent)/8192 101 ns 68.8 ns std::set<int>::erase(key) (non-existent)/0 0.511 ns 0.328 ns std::set<int>::erase(key) (non-existent)/32 9.60 ns 4.67 ns std::set<int>::erase(key) (non-existent)/1024 26.5 ns 11.2 ns std::set<int>::erase(key) (non-existent)/8192 46.2 ns 16.8 ns std::set<int>::find(key) (existent)/0 0.008 ns 0.007 ns std::set<int>::find(key) (existent)/32 5.87 ns 4.51 ns std::set<int>::find(key) (existent)/1024 14.3 ns 8.69 ns std::set<int>::find(key) (existent)/8192 30.2 ns 12.8 ns std::set<int>::find(key) (non-existent)/0 0.531 ns 0.530 ns std::set<int>::find(key) (non-existent)/32 8.77 ns 4.64 ns std::set<int>::find(key) (non-existent)/1024 26.1 ns 21.7 ns std::set<int>::find(key) (non-existent)/8192 36.3 ns 27.8 ns std::set<std::string>::erase(key) (existent)/0 93.2 ns 70.2 ns std::set<std::string>::erase(key) (existent)/32 164 ns 116 ns std::set<std::string>::erase(key) (existent)/1024 161 ns 136 ns std::set<std::string>::erase(key) (existent)/8192 231 ns 140 ns std::set<std::string>::erase(key) (non-existent)/0 0.532 ns 0.326 ns std::set<std::string>::erase(key) (non-existent)/32 43.4 ns 40.1 ns std::set<std::string>::erase(key) (non-existent)/1024 122 ns 99.5 ns std::set<std::string>::erase(key) (non-existent)/8192 168 ns 125 ns std::set<std::string>::find(key) (existent)/0 0.059 ns 0.059 ns std::set<std::string>::find(key) (existent)/32 53.1 ns 35.5 ns std::set<std::string>::find(key) (existent)/1024 124 ns 61.2 ns std::set<std::string>::find(key) (existent)/8192 154 ns 73.9 ns std::set<std::string>::find(key) (non-existent)/0 0.532 ns 0.301 ns std::set<std::string>::find(key) (non-existent)/32 44.4 ns 39.5 ns std::set<std::string>::find(key) (non-existent)/1024 120 ns 95.5 ns std::set<std::string>::find(key) (non-existent)/8192 193 ns 119 ns std::multimap<int, int>::erase(key) (existent)/0 26.5 ns 26.6 ns std::multimap<int, int>::erase(key) (existent)/32 33.5 ns 32.9 ns std::multimap<int, int>::erase(key) (existent)/1024 55.5 ns 58.0 ns std::multimap<int, int>::erase(key) (existent)/8192 67.4 ns 70.0 ns std::multimap<int, int>::erase(key) (non-existent)/0 0.523 ns 0.532 ns std::multimap<int, int>::erase(key) (non-existent)/32 5.08 ns 5.09 ns std::multimap<int, int>::erase(key) (non-existent)/1024 13.0 ns 12.9 ns std::multimap<int, int>::erase(key) (non-existent)/8192 19.6 ns 19.8 ns std::multimap<int, int>::find(key) (existent)/0 0.015 ns 0.037 ns std::multimap<int, int>::find(key) (existent)/32 7.07 ns 3.85 ns std::multimap<int, int>::find(key) (existent)/1024 22.0 ns 7.44 ns std::multimap<int, int>::find(key) (existent)/8192 37.6 ns 12.0 ns std::multimap<int, int>::find(key) (non-existent)/0 0.297 ns 0.305 ns std::multimap<int, int>::find(key) (non-existent)/32 8.79 ns 4.59 ns std::multimap<int, int>::find(key) (non-existent)/1024 26.0 ns 11.2 ns std::multimap<int, int>::find(key) (non-existent)/8192 36.4 ns 16.8 ns std::multimap<std::string, int>::erase(key) (existent)/0 93.4 ns 84.5 ns std::multimap<std::string, int>::erase(key) (existent)/32 101 ns 101 ns std::multimap<std::string, int>::erase(key) (existent)/1024 118 ns 126 ns std::multimap<std::string, int>::erase(key) (existent)/8192 108 ns 124 ns std::multimap<std::string, int>::erase(key) (non-existent)/0 2.39 ns 2.43 ns std::multimap<std::string, int>::erase(key) (non-existent)/32 44.4 ns 49.7 ns std::multimap<std::string, int>::erase(key) (non-existent)/1024 108 ns 103 ns std::multimap<std::string, int>::erase(key) (non-existent)/8192 140 ns 125 ns std::multimap<std::string, int>::find(key) (existent)/0 0.059 ns 0.058 ns std::multimap<std::string, int>::find(key) (existent)/32 52.3 ns 32.6 ns std::multimap<std::string, int>::find(key) (existent)/1024 122 ns 58.9 ns std::multimap<std::string, int>::find(key) (existent)/8192 160 ns 72.7 ns std::multimap<std::string, int>::find(key) (non-existent)/0 0.524 ns 0.494 ns std::multimap<std::string, int>::find(key) (non-existent)/32 43.8 ns 38.9 ns std::multimap<std::string, int>::find(key) (non-existent)/1024 123 ns 90.8 ns std::multimap<std::string, int>::find(key) (non-existent)/8192 190 ns 126 ns std::multiset<int>::erase(key) (existent)/0 27.1 ns 26.8 ns std::multiset<int>::erase(key) (existent)/32 33.3 ns 34.1 ns std::multiset<int>::erase(key) (existent)/1024 58.5 ns 58.8 ns std::multiset<int>::erase(key) (existent)/8192 66.7 ns 64.1 ns std::multiset<int>::erase(key) (non-existent)/0 0.318 ns 0.325 ns std::multiset<int>::erase(key) (non-existent)/32 5.15 ns 5.25 ns std::multiset<int>::erase(key) (non-existent)/1024 12.9 ns 12.7 ns std::multiset<int>::erase(key) (non-existent)/8192 20.3 ns 20.3 ns std::multiset<int>::find(key) (existent)/0 0.043 ns 0.015 ns std::multiset<int>::find(key) (existent)/32 6.94 ns 4.22 ns std::multiset<int>::find(key) (existent)/1024 21.4 ns 8.23 ns std::multiset<int>::find(key) (existent)/8192 37.4 ns 12.6 ns std::multiset<int>::find(key) (non-existent)/0 0.515 ns 0.300 ns std::multiset<int>::find(key) (non-existent)/32 8.52 ns 4.62 ns std::multiset<int>::find(key) (non-existent)/1024 25.5 ns 11.3 ns std::multiset<int>::find(key) (non-existent)/8192 36.5 ns 27.0 ns std::multiset<std::string>::erase(key) (existent)/0 81.9 ns 77.5 ns std::multiset<std::string>::erase(key) (existent)/32 113 ns 129 ns std::multiset<std::string>::erase(key) (existent)/1024 132 ns 148 ns std::multiset<std::string>::erase(key) (existent)/8192 114 ns 165 ns std::multiset<std::string>::erase(key) (non-existent)/0 2.33 ns 2.32 ns std::multiset<std::string>::erase(key) (non-existent)/32 44.4 ns 42.0 ns std::multiset<std::string>::erase(key) (non-existent)/1024 97.3 ns 95.1 ns std::multiset<std::string>::erase(key) (non-existent)/8192 132 ns 123 ns std::multiset<std::string>::find(key) (existent)/0 0.058 ns 0.059 ns std::multiset<std::string>::find(key) (existent)/32 48.3 ns 34.4 ns std::multiset<std::string>::find(key) (existent)/1024 121 ns 61.9 ns std::multiset<std::string>::find(key) (existent)/8192 155 ns 77.7 ns std::multiset<std::string>::find(key) (non-existent)/0 0.524 ns 0.306 ns std::multiset<std::string>::find(key) (non-existent)/32 44.1 ns 40.4 ns std::multiset<std::string>::find(key) (non-existent)/1024 121 ns 96.3 ns std::multiset<std::string>::find(key) (non-existent)/8192 193 ns 121 ns ```
2025-08-15[libc++] Optimize __hash_table copy constructors and assignment (#151951)Nikolas Klauser1-0/+2
``` ---------------------------------------------------------------------------------------------------------------------- Benchmark old new ---------------------------------------------------------------------------------------------------------------------- std::unordered_set<int>::ctor(const&)/0 15.4 ns 14.6 ns std::unordered_set<int>::ctor(const&)/32 686 ns 322 ns std::unordered_set<int>::ctor(const&)/1024 35839 ns 21490 ns std::unordered_set<int>::ctor(const&)/8192 385790 ns 280270 ns std::unordered_set<int>::operator=(const&) (into cleared Container)/0 15.1 ns 15.9 ns std::unordered_set<int>::operator=(const&) (into cleared Container)/32 1077 ns 333 ns std::unordered_set<int>::operator=(const&) (into cleared Container)/1024 31296 ns 9984 ns std::unordered_set<int>::operator=(const&) (into cleared Container)/8192 266776 ns 109418 ns std::unordered_set<int>::operator=(const&) (into partially populated Container)/0 15.1 ns 16.3 ns std::unordered_set<int>::operator=(const&) (into partially populated Container)/32 962 ns 320 ns std::unordered_set<int>::operator=(const&) (into partially populated Container)/1024 31713 ns 10128 ns std::unordered_set<int>::operator=(const&) (into partially populated Container)/8192 266113 ns 108525 ns std::unordered_set<int>::operator=(const&) (into populated Container)/0 0.990 ns 2.03 ns std::unordered_set<int>::operator=(const&) (into populated Container)/32 963 ns 263 ns std::unordered_set<int>::operator=(const&) (into populated Container)/1024 27600 ns 7793 ns std::unordered_set<int>::operator=(const&) (into populated Container)/8192 235295 ns 66248 ns std::unordered_set<std::string>::ctor(const&)/0 16.0 ns 15.0 ns std::unordered_set<std::string>::ctor(const&)/32 2950 ns 1277 ns std::unordered_set<std::string>::ctor(const&)/1024 246935 ns 73762 ns std::unordered_set<std::string>::ctor(const&)/8192 3310895 ns 2468608 ns std::unordered_set<std::string>::operator=(const&) (into cleared Container)/0 16.1 ns 15.8 ns std::unordered_set<std::string>::operator=(const&) (into cleared Container)/32 5856 ns 1039 ns std::unordered_set<std::string>::operator=(const&) (into cleared Container)/1024 170436 ns 74836 ns std::unordered_set<std::string>::operator=(const&) (into cleared Container)/8192 1574235 ns 1096891 ns std::unordered_set<std::string>::operator=(const&) (into partially populated Container)/0 16.0 ns 16.3 ns std::unordered_set<std::string>::operator=(const&) (into partially populated Container)/32 5571 ns 1064 ns std::unordered_set<std::string>::operator=(const&) (into partially populated Container)/1024 199220 ns 75462 ns std::unordered_set<std::string>::operator=(const&) (into partially populated Container)/8192 1552465 ns 1116094 ns std::unordered_set<std::string>::operator=(const&) (into populated Container)/0 1.70 ns 2.14 ns std::unordered_set<std::string>::operator=(const&) (into populated Container)/32 2562 ns 645 ns std::unordered_set<std::string>::operator=(const&) (into populated Container)/1024 228608 ns 39100 ns std::unordered_set<std::string>::operator=(const&) (into populated Container)/8192 2013723 ns 390401 ns ``` Fixes #77657
2025-08-13[libc++][ranges] LWG4096: `views::iota(views::iota(0))` should be rejected ↵Hristo Hristov1-1/+1
(#152855) Fixes #105352
2025-08-10[libc++] Implement LWG4222 'expected' constructor from a single value ↵yronglin1-1/+1
missing a constraint (#152676) Implement [LWG4222](https://wg21.link/LWG4222). Closes https://github.com/llvm/llvm-project/issues/148208 Signed-off-by: yronglin <yronglin777@gmail.com>
2025-08-06[libcxx] Update testing documentation about CI container images. (#149192)cmtice1-10/+79
Add information to the libcxx testing documentation, about the names of the new CI libcxx runner sets, their current values, and how to change the values or the runner set being used.
2025-08-05[libc++] Optimize copy construction and assignment of __tree (#151304)Nikolas Klauser1-0/+3
``` ---------------------------------------------------------------------------------------------------------- Benchmark old new ---------------------------------------------------------------------------------------------------------- std::map<int, int>::ctor(const&)/0 15.5 ns 14.9 ns std::map<int, int>::ctor(const&)/32 474 ns 321 ns std::map<int, int>::ctor(const&)/1024 24591 ns 11101 ns std::map<int, int>::ctor(const&)/8192 236153 ns 98868 ns std::map<std::string, int>::ctor(const&)/0 15.2 ns 14.9 ns std::map<std::string, int>::ctor(const&)/32 2673 ns 2340 ns std::map<std::string, int>::ctor(const&)/1024 115354 ns 86088 ns std::map<std::string, int>::ctor(const&)/8192 1298510 ns 626876 ns std::map<int, int>::operator=(const&) (into cleared Container)/0 16.5 ns 16.1 ns std::map<int, int>::operator=(const&) (into cleared Container)/32 548 ns 323 ns std::map<int, int>::operator=(const&) (into cleared Container)/1024 28418 ns 11026 ns std::map<int, int>::operator=(const&) (into cleared Container)/8192 281827 ns 97113 ns std::map<int, int>::operator=(const&) (into populated Container)/0 2.42 ns 1.85 ns std::map<int, int>::operator=(const&) (into populated Container)/32 369 ns 73.0 ns std::map<int, int>::operator=(const&) (into populated Container)/1024 24078 ns 2322 ns std::map<int, int>::operator=(const&) (into populated Container)/8192 266537 ns 22963 ns std::map<std::string, int>::operator=(const&) (into cleared Container)/0 16.6 ns 16.2 ns std::map<std::string, int>::operator=(const&) (into cleared Container)/32 2614 ns 1622 ns std::map<std::string, int>::operator=(const&) (into cleared Container)/1024 116826 ns 63281 ns std::map<std::string, int>::operator=(const&) (into cleared Container)/8192 1316655 ns 649177 ns std::map<std::string, int>::operator=(const&) (into populated Container)/0 2.42 ns 1.89 ns std::map<std::string, int>::operator=(const&) (into populated Container)/32 1264 ns 581 ns std::map<std::string, int>::operator=(const&) (into populated Container)/1024 238826 ns 39943 ns std::map<std::string, int>::operator=(const&) (into populated Container)/8192 2412327 ns 379456 ns ``` Fixes #77658 Fixes #62571
2025-08-01[libc++] Implement comparison operators for `tuple` added in C++23 (#148799)A. Jiang5-3/+6
And constrain the new `operator==` since C++26. This patch implements parts of P2165R4, P2944R3, and a possibly improved resolution of LWG3882. Currently, libstdc++ and MSVC STL constrain the new overloads in the same way. Also set feature-test macro `__cpp_lib_constrained_equality` and add related release note, as P2944R3 will completed with this patch. Fixes #136765 Fixes #136770 Fixes #105424
2025-07-29[libc++][hardening] Introduce assertion semantics. (#149459)Konstantin Varlamov3-0/+79
Assertion semantics closely mimic C++26 Contracts evaluation semantics. This brings our implementation closer in line with C++26 Library Hardening (one particular benefit is that using the `observe` semantic makes adopting hardening easier for projects).
2025-07-20[libc++][ranges] implement `std::ranges::zip_transform_view` (#79605)Hui2-3/+4
Fixes #104977 Fixes #105035 --------- Co-authored-by: Louis Dionne <ldionne.2@gmail.com> Co-authored-by: A. Jiang <de34@live.cn>
2025-07-19[libc++] Add and empty skeleton for LLVM 22 release notes (#149535)Louis Dionne2-1/+60
2025-07-18[libc++][NFC] Fix typos in the libc++ 21 release notes (#149536)Louis Dionne1-2/+2
2025-07-15[libc++][docs] Add missing entry for status pages, fix bad formatting, and ↵A. Jiang4-12/+13
deduplicate (#148186) In a previously PR, the entry for P3491R3 define_static_{string,object,array} was missing. This patch adds it back. The number of LWG2687, LWG2709, LWG3315, LWG3395, LWG3987, and LWG4113 were duplicated in the title. It seems better to avoid such duplicates. Also fixes some formatting to properly use italic and code styles, and remove one improper leading space from the title of P3682R0 (which caused incorrect alignment in the generated page).
2025-07-15[libc++] Bump Xcode support (#148651)Louis Dionne1-1/+1
Libc++'s policy is to support only the latest released Xcode, which is Xcode 16.x. We did update our CI jobs to Xcode 16.x, but we forgot to update the documentation, which still mentioned Xcode 15. This patch updates the documentation and cleans up outdated mentions of apple-clang-15 in the test suite.
2025-07-15Revert "[libc++][hardening] Introduce assertion semantics" (#148822)Nikolas Klauser2-66/+0
Reverts llvm/llvm-project#148268 It looks like this was based on #148266, which I reverted in #148787.
2025-07-15[libc++][hardening] Introduce assertion semantics (#148268)Konstantin Varlamov2-0/+66
Assertion semantics closely mimic C++26 Contracts evaluation semantics. This brings our implementation closer in line with C++26 Library Hardening (one particular benefit is that using the `observe` semantic makes adopting hardening easier for projects).
2025-07-15[libc++] P2944R3: Constrained comparisons - `optional` (#144249)Hristo Hristov1-1/+1
Partially implements [P2944R3](https://wg21.link/P2944R3) which adds constrained comparisons to std::optional. Closes #136767 # References [optional.relops](https://wg21.link/optional.relops) [optional.comp.with.t](https://wg21.link/optional.comp.with.t) --------- Co-authored-by: Hristo Hristov <zingam@outlook.com>
2025-07-14[libc++][docs] Confirm that P2372R3 has been implemented (#148573)A. Jiang2-1/+2
In #125921, the changes requested by P2372R3 were completed and tested together with corresponding `chrono` types. But that PR didn't mention P2372R3. The `__cpp_lib_format` FTM was even bumped by an earlier PR #98275. This PR confirms that P2372R3 was completed in LLVM 21 (together with P1361R2). Closes #100043
2025-07-13[libcxx] Fix a typo in documentation (#148557)Kazu Hirata1-1/+1
2025-07-10[libc++] Remove the `packaged_task::result_type` extension (#147671)A. Jiang1-1/+1
No escape hatch added, as there doesn't seem anyone critically relying on this.
2025-07-10[libc++][docs] Update paper & LWG issue lists after 2025-06 meeting (#147668)A. Jiang2-0/+64
CWG papers requiring library support are also listed.
2025-07-09[libc++] Optimize ctype::to{lower,upper} (#145344)Nikolas Klauser1-0/+2
``` ---------------------------------------------- Benchmark old new --------------------------- ------------------ BM_tolower_char<char> 1.64 ns 1.41 ns BM_tolower_char<wchar_t> 1.64 ns 1.41 ns BM_tolower_string<char> 32.4 ns 12.8 ns BM_tolower_string<wchar_t> 32.9 ns 15.1 ns BM_toupper_char<char> 1.63 ns 1.64 ns BM_toupper_char<wchar_t> 1.63 ns 1.41 ns BM_toupper_string<char> 32.2 ns 12.7 ns BM_toupper_string<wchar_t> 33.0 ns 15.1 ns ```
2025-07-09[libc++] Mark a few LWG issues as complete instead of Nothing To DoLouis Dionne2-5/+5
A few LWG issues did require some testing changes and were not just non-normative wording changes in the spec, so those should be "Complete" instead of "Nothing to do". Also mark LWG3987 and LWG4113 as complete: - LWG3987 was done in https://github.com/llvm/llvm-project/pull/137524 - LWG4113 was done in https://github.com/llvm/llvm-project/pull/138291
2025-07-09[libc++][docs] Fix bad status and links in Cxx2cIssues.csv (#147669)A. Jiang1-11/+11
Currently, versions for (already implemented) LWG4024 and LWG4157 are listed, but they are not marked "Complete" yet. - LWG4024 was implemented together with P1020R1 + P1973R1 in 9af9d39a47d. - LWG4157 was implemented together with P2167R3 in 557f7e1398e1. Moreover, links for LWG issues resolved in 2025-02 Hagenberg meeting were broken, they need to be fixed.
2025-07-06[libc++] P2655R3 common_reference_t of reference_wrapper Should Be a ↵Hui3-1/+6
Reference Type (#141408) Fixes #105260 This patch applies the change as a DR to C++20. The rationale is that the paper is more like a bug fix. It does not introduce new features, it simply changes an existing behaviour (as a bug fix). MSVC STL DRed this paper to C++20 as well.
2025-07-06[libc++][doc][NFC] update release notes on P3372R3 (#147161)Hui1-1/+1
2025-07-05[libc++] Add the thread safety annotations unconditionally (#117497)Nikolas Klauser1-5/+0
For these annotations to do anything you need `-Wthread-safety`, in which case users most likely enable them anyways. This avoids that users have to explictly define a macro just to use the feature they already had to opt-in to.
2025-06-28[libc++] Introduce `__product_iterator_traits` and optimise ↵Hui1-0/+3
`flat_map::insert` (#139454) Fixes #108624 This allows `flat_map::insert(Iter, Iter)` to directly forward to underlying containers' `insert(Iter, Iter)`, instead of inserting one element at a time, when input models "product iterator". atm, `flat_map::iterator` and `zip_view::iterator` are "product iterator"s. This gives about almost 10x speed up in my benchmark with -03 (for both before and after) ```cpp Benchmark Time CPU Time Old Time New CPU Old CPU New ----------------------------------------------------------------------------------------------------------------------------------------------- flat_map::insert_product_iterator_flat_map/32 -0.5028 -0.5320 149 74 149 70 flat_map::insert_product_iterator_flat_map/1024 -0.8617 -0.8618 3113 430 3112 430 flat_map::insert_product_iterator_flat_map/8192 -0.8877 -0.8877 26682 2995 26679 2995 flat_map::insert_product_iterator_flat_map/65536 -0.8769 -0.8769 226235 27844 226221 27841 flat_map::insert_product_iterator_zip/32 -0.5844 -0.5844 162 67 162 67 flat_map::insert_product_iterator_zip/1024 -0.8754 -0.8754 3427 427 3427 427 flat_map::insert_product_iterator_zip/8192 -0.8934 -0.8934 28134 3000 28132 3000 flat_map::insert_product_iterator_zip/65536 -0.8783 -0.8783 229783 27960 229767 27958 OVERALL_GEOMEAN -0.8319 -0.8332 0 0 0 0 ``` --------- Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-06-27[libc++] P2944R3: Constrained comparisions - `tuple` (#145677)Hristo Hristov1-1/+1
Implements P2944R3 partially, which adds constrained comparisons `std::tuple`. The missing overloads introduced in [P2165R4](https://wg21.link/P2165R4) are not implemented. Uses [`__all`](https://github.com/llvm/llvm-project/blob/f7af33a9eb5b3876f219075023dc9c565d75849b/libcxx/include/__type_traits/conjunction.h#L45) instead of a fold expression, see comment: https://github.com/llvm/llvm-project/pull/141396#discussion_r2161166077 Relates to #136765 # References [tuple.rel](https://wg21.link//tuple.rel)