summaryrefslogtreecommitdiffstats
path: root/libcxx/include/__string
Commit message (Collapse)AuthorAgeFilesLines
* Revert "[libc++] Explicitly enumerate std::string external instantiations."Oliver Stannard2020-01-131-54/+0
| | | | | | | This is causing failures for multiple buildbots and bootstrap builds, details at https://reviews.llvm.org/rG61bd1920. This reverts commit 61bd19206f61ace4b007838a2ff8884a13ec0374.
* [libc++] Explicitly enumerate std::string external instantiations.Eric Fiselier2020-01-091-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | The external instantiation of std::string is a problem for libc++. Additions and removals of inline functions in string can cause ABI breakages, including introducing new symbols. This patch aims to: (1) Make clear which functions are explicitly instatiated. (2) Prevent new functions from being accidentally instantiated. (3) Allow a migration path for adding or removing functions from the explicit instantiation over time. Although this new formulation is uglier, it is preferable from a maintainability and readability standpoint because it explicitly enumerates the functions we've chosen to expose in our ABI. Changing this list is non-trivial and requires thought and planning. (3) is achieved by making it possible to control the extern template declaration separately from it's definition. Meaning we could add a new definition to the dylib, wait for it to roll out, then add the extern template declaration to the header. Similarly, we could remove existing extern template declarations while still keeping the definition to prevent ABI breakages.
* [libc++][P0980] Marked member functions move/copy/assign of char_traits ↵Michael Park2019-11-111-41/+117
| | | | | | | | | | | | | | constexpr. Reviewers: ldionne, EricWF, mclow.lists Reviewed By: ldionne Subscribers: christof, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D68840
* [NFC] Strip trailing whitespace from libc++Louis Dionne2019-10-231-11/+11
|
* Add debug check for null pointers passed to <string_view>Eric Fiselier2019-09-141-0/+12
| | | | llvm-svn: 371925
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308Marshall Clow2018-12-111-0/+97
| | | | llvm-svn: 348828
* Fix misleading indentation; replace a couple of NULLs with nullptr. Resolves ↵Marshall Clow2018-02-061-5/+5
| | | | | | https://reviews.llvm.org/D42945 ; thanks to Bruce Mitchener for the patch. llvm-svn: 324378
* [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on WindowsEric Fiselier2017-05-311-2/+6
| | | | | | | | | | | | | | | | Summary: This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning. This patch changes libc++ to use `#pragma push_macro` to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header. Reviewers: mclow.lists, bcraig, compnerd, EricWF Reviewed By: EricWF Subscribers: cfe-commits, krytarowski Differential Revision: https://reviews.llvm.org/D33080 llvm-svn: 304357
* Use the new __has_feature(cxx_constexpr_string_builtins) for detection of ↵Marshall Clow2017-01-261-5/+7
| | | | | | the C-string intrinsics for constexpr support in std::char_traits. Thanks to Richard for the intrisic support. llvm-svn: 293154
* disable use of __builtin_memcmp temporarily to get the tests passing againMarshall Clow2017-01-121-3/+24
| | | | llvm-svn: 291742
* Implement P0426: Constexpr for std::char_traitsMarshall Clow2017-01-121-51/+135
| | | | llvm-svn: 291741
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-5/+5
| | | | | | | | | | | | | The name _LIBCPP_TYPE_VIS_ONLY is no longer accurate because both _LIBCPP_TYPE_VIS and _LIBCPP_TYPE_VIS_ONLY expand to __attribute__((__type_visibility__)) with Clang. The only remaining difference is that _LIBCPP_TYPE_VIS_ONLY can be applied to templates whereas _LIBCPP_TYPE_VIS cannot (due to dllimport/dllexport not being allowed on templates). This patch renames _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS. llvm-svn: 291035
* improve performance of string::findSebastian Pop2016-12-301-6/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | string::find used to call the generic algorithm ::find. The patch special case string::find such that it ultimately gets converted to calls to memchr and memcmp. The patch improves the performance of the string::find routine by about 20x. Without the patch, the performance on an x86_64-linux 3400 MHz machine is: Benchmark Time CPU Iterations ----------------------------------------------------------------- BM_StringFindNoMatch/10 4 ns 4 ns 166421326 BM_StringFindNoMatch/64 37 ns 37 ns 18754392 BM_StringFindNoMatch/512 268 ns 268 ns 2586060 BM_StringFindNoMatch/4k 2143 ns 2144 ns 328342 BM_StringFindNoMatch/32k 16910 ns 16917 ns 40623 BM_StringFindNoMatch/128k 67577 ns 67602 ns 10138 BM_StringFindAllMatch/1 3 ns 3 ns 265163471 BM_StringFindAllMatch/8 6 ns 6 ns 112582467 BM_StringFindAllMatch/64 36 ns 36 ns 19566457 BM_StringFindAllMatch/512 209 ns 209 ns 3318893 BM_StringFindAllMatch/4k 1618 ns 1618 ns 432963 BM_StringFindAllMatch/32k 12909 ns 12914 ns 54317 BM_StringFindAllMatch/128k 48342 ns 48361 ns 13922 BM_StringFindMatch1/1 33777 ns 33790 ns 20698 BM_StringFindMatch1/8 33940 ns 33953 ns 20619 BM_StringFindMatch1/64 34038 ns 34051 ns 20571 BM_StringFindMatch1/512 34217 ns 34230 ns 20480 BM_StringFindMatch1/4k 35510 ns 35524 ns 19752 BM_StringFindMatch1/32k 46438 ns 46456 ns 15030 BM_StringFindMatch2/1 33839 ns 33852 ns 20648 BM_StringFindMatch2/8 33950 ns 33963 ns 20594 BM_StringFindMatch2/64 33846 ns 33859 ns 20668 BM_StringFindMatch2/512 34023 ns 34036 ns 20279 BM_StringFindMatch2/4k 35422 ns 35436 ns 19716 BM_StringFindMatch2/32k 46570 ns 46588 ns 15027 With the patch applied Benchmark Time CPU Iterations ----------------------------------------------------------------- BM_StringFindNoMatch/10 5 ns 5 ns 133724346 BM_StringFindNoMatch/64 6 ns 6 ns 119312184 BM_StringFindNoMatch/512 13 ns 13 ns 51539628 BM_StringFindNoMatch/4k 77 ns 77 ns 8935934 BM_StringFindNoMatch/32k 551 ns 551 ns 1222808 BM_StringFindNoMatch/128k 2684 ns 2685 ns 259957 BM_StringFindAllMatch/1 7 ns 7 ns 98017959 BM_StringFindAllMatch/8 7 ns 7 ns 91466911 BM_StringFindAllMatch/64 8 ns 8 ns 85707392 BM_StringFindAllMatch/512 20 ns 20 ns 34490895 BM_StringFindAllMatch/4k 93 ns 93 ns 7360375 BM_StringFindAllMatch/32k 827 ns 828 ns 829944 BM_StringFindAllMatch/128k 3593 ns 3594 ns 195815 BM_StringFindMatch1/1 1332 ns 1332 ns 516354 BM_StringFindMatch1/8 1336 ns 1336 ns 495876 BM_StringFindMatch1/64 1338 ns 1339 ns 516656 BM_StringFindMatch1/512 1357 ns 1357 ns 510717 BM_StringFindMatch1/4k 1485 ns 1486 ns 461228 BM_StringFindMatch1/32k 2235 ns 2236 ns 318253 BM_StringFindMatch2/1 1335 ns 1335 ns 517105 BM_StringFindMatch2/8 1336 ns 1337 ns 518004 BM_StringFindMatch2/64 1344 ns 1345 ns 511751 BM_StringFindMatch2/512 1361 ns 1361 ns 508150 BM_StringFindMatch2/4k 1611 ns 1611 ns 463388 BM_StringFindMatch2/32k 2187 ns 2187 ns 317532 Patch written by Aditya Kumar and Sebastian Pop. Differential Revision: https://reviews.llvm.org/D27068 llvm-svn: 290761
* [libc++] Fix and document visibility attributes for Clang, GCC and Windows.Eric Fiselier2016-09-151-1/+2
| | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes a number of problems with the visibility macros across GCC (on Unix) and Windows (DLL import/export semantics). All of the visibility macros are now documented under `DesignDocs/VisibilityMacros.rst`. Now I'll no longer forget the subtleties of each! This patch adds two new visibility macros: * `_LIBCPP_ENUM_VIS` for controlling the typeinfo of enum types. Only Clang supports this. * `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` for redefining visibility on explicit instantiation declarations. Clang and Windows require this. After applying this patch GCC only emits one -Wattribute warning opposed to 30+. Reviewers: mclow.lists, EricWF Subscribers: beanz, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D24602 llvm-svn: 281673
* Add a bunch of noexcepts to char_traits and string_view.Marshall Clow2016-07-281-36/+36
| | | | llvm-svn: 276955
* Implement std::string_view as described in http://wg21.link/P0254R1. ↵Marshall Clow2016-07-211-0/+725
Reviewed as https://reviews.llvm.org/D21459 llvm-svn: 276238
OpenPOWER on IntegriCloud