summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
...
* build: differentiate between building for and on WindowsSaleem Abdulrasool2017-01-011-1/+1
| | | | | | | | | This is necessary to support cross-compiling a Windows libc++ from Linux. The CMAKE_SYSTEM_HOST_NAME tells you what, in autotools parlance, is known as the build as opposed to WIN32 which maps to, in autotools parlance, host. llvm-svn: 290800
* clean up some qualifier castingSaleem Abdulrasool2016-12-312-2/+3
| | | | | | | This cleans up the `-Wqual-cast` warnings from gcc 6 when building libc++. NFC. llvm-svn: 290789
* remove some inherited attributes on exceptionsSaleem Abdulrasool2016-12-312-2/+1
| | | | | | | | | | | | | | These exception types are marked with `_LIBCPP_EXCEPTION_ABI` which expands to `__attribute__((__visibility__("default")))` or `__declspec(dllexport)`. When building for Windows, we would hit an error: cannot apply 'dllexport' to a 'dllexport' class Remove the duplicate annotations as they will be inherited from the class. llvm-svn: 290785
* 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
* Recommit r290750: Fix PR19460 - std::ios is convertible to int.Eric Fiselier2016-12-302-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two problems with the initial fix. 1. The added tests flushed out that we misconfigured _LIBCPP_EXPLICIT with GCC. 2. Because the boolean type was a member function template it caused weird link errors. I'm assuming due to the vague linkage rules. This time the bool type is a non-template member function pointer. That seems to have fixed the failing tests. Plus it will end up generating less symbols overall, since the bool type is no longer per instantiation. original commit message below ----------------------------- std::basic_ios has an operator bool(). In C++11 and later it is explicit, and only allows contextual implicit conversions. However explicit isn't available in C++03 which causes std::istream (et al) to have an implicit conversion to int. This can easily cause ambiguities when calling operator<< and operator>>. This patch uses a "bool-like" type in C++03 to work around this. The "bool-like" type is an arbitrary pointer to member function type. It will not convert to either int or void*, but will convert to bool. llvm-svn: 290754
* Revert r290750 - Fix PR19460 - std::ios is convertible to int.Eric Fiselier2016-12-301-15/+2
| | | | llvm-svn: 290752
* Fix PR19460 - std::ios is convertible to int.Eric Fiselier2016-12-301-2/+15
| | | | | | | | | | | | | | | std::basic_ios has an operator bool(). In C++11 and later it is explicit, and only allows contextual implicit conversions. However explicit isn't available in C++03 which causes std::istream (et al) to have an implicit conversion to int. This can easily cause ambiguities when calling operator<< and operator>>. This patch uses a "bool-like" type in C++03 to work around this. The "bool-like" type is an arbitrary pointer to member function type. It will not convert to either int or void*, but will convert to bool. llvm-svn: 290750
* Remove mblen(), mbtowc() and wctomb() from the thread-unsafe functions.Ed Schouten2016-12-302-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back in r240527 I added a knob to prevent thread-unsafe functions from being exposed. mblen(), mbtowc() and wctomb() were also added to this list, as the latest issue of POSIX doesn't require these functions to be thread-safe. It turns out that the only circumstance in which these functions are not thread-safe is in case they are used in combination with state-dependent character sets (e.g., Shift-JIS). According to Austin Group Bug 708, these character sets "[...] are mostly a relic of the past and which were never supported on most POSIX systems". Though in many cases the use of these functions can be prevented by using the reentrant counterparts, they are the only functions that allow you to query whether the locale's character set is state-dependent. This means that omitting these functions removes actual functionality. Let's be a bit less pedantic and drop the guards around these functions. Links: http://austingroupbugs.net/view.php?id=708 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2037.htm Reviewed by: ericwf Differential Revision: https://reviews.llvm.org/D21436 llvm-svn: 290748
* Fix PR31489 - std::function self-swap segfaultsEric Fiselier2016-12-292-0/+10
| | | | llvm-svn: 290721
* Fix typo in commentEric Fiselier2016-12-281-1/+1
| | | | llvm-svn: 290666
* Fix ABI incompatible C++03 nullptr_tEric Fiselier2016-12-281-1/+9
| | | | | | | | | | | | | In C++03 libc++ emulates nullptr_t using a class, and #define's nullptr. However this makes nullptr_t mangle differently between C++03 and C++11. This breaks any function ABI which takes nullptr_t. Thanfully Clang provides __nullptr in all dialects. This patch adds an ABI option to switch to using __nullptr in C++03. In a perfect world I would like to turn this on by default, since it's just ABI breaking fix to an ABI breaking bug. llvm-svn: 290662
* Ensure <__debug> gets the nullptr definition in C++03Eric Fiselier2016-12-281-0/+4
| | | | llvm-svn: 290658
* Fix debug mode for vector/list and cleanup testsEric Fiselier2016-12-282-45/+65
| | | | llvm-svn: 290657
* Fix stupid build error caused by a stupid personEric Fiselier2016-12-281-0/+3
| | | | llvm-svn: 290656
* Add tests for unordered container tests and std::stringEric Fiselier2016-12-283-15/+23
| | | | llvm-svn: 290655
* Fix __wrap_iter in debug mode and apply _NOEXCEPT_DEBUG to itEric Fiselier2016-12-282-46/+86
| | | | llvm-svn: 290654
* Fix build errors in C++03 caused by recent debug changesEric Fiselier2016-12-281-1/+4
| | | | llvm-svn: 290653
* Fix debug mode build w/o exceptionsEric Fiselier2016-12-281-0/+3
| | | | llvm-svn: 290652
* Implement a throwing version of _LIBCPP_ASSERT.Eric Fiselier2016-12-282-11/+76
| | | | | | | | | | | | | | | | | | | | | | | | | This patch implements changes to allow _LIBCPP_ASSERT to throw on failure instead of aborting. The main changes needed to do this are: 1. Change _LIBCPP_ASSERT to call a handler via a replacable function pointer instead of calling abort directly. Additionally this patch implements two handler functions, one which aborts and another that throws an exception. 2. Add _NOEXCEPT_DEBUG macro for disabling noexcept spec on function which contain _LIBCPP_ASSERT. This is required in order to prevent assertion failures throwing through a noexcept function. This macro has no effect unless _LIBCPP_DEBUG_USE_EXCEPTIONS is defined. Having a non-aborting _LIBCPP_ASSERT is very important to allow sane testing of debug mode. Currently we can only have one test case per file, since the test case will cause the program to abort. Testing debug mode this way would require thousands of test files, most of which would be 95% boiler plate. I don't think this is a feasible strategy. Fortunately using a throwing debug handler solves these issues. Additionally this patch rewrites the documentation for debug mode. llvm-svn: 290651
* Implement P0435R1 - Resolving LWG issues for common_typeEric Fiselier2016-12-271-2/+12
| | | | llvm-svn: 290627
* Fix PR31481 - 3+ parameter common_type isn't SFINAE friendlyEric Fiselier2016-12-271-3/+11
| | | | llvm-svn: 290624
* [libc++] Make __num_get_float hiddenShoaib Meenai2016-12-241-0/+1
| | | | | | | | | | | It's an internal function and shouldn't be exported. It's also a source of discrepancy in the published ABI list; these symbols aren't exported for me on CentOS 7 or Ubuntu 16.04, leading to spurious check-cxx-abilist failures. Differential Revision: https://reviews.llvm.org/D27153 llvm-svn: 290503
* Fix bug #31387 - not checking end iterator when parsing decimal escape. ↵Marshall Clow2016-12-241-1/+2
| | | | | | Thanks to Karen for the report. llvm-svn: 290500
* Avoid unused warning in __throw_future_error w/o exceptions enabledEric Fiselier2016-12-241-0/+1
| | | | llvm-svn: 290479
* fix sign comparison warningsEric Fiselier2016-12-245-33/+34
| | | | llvm-svn: 290469
* Fix unused parameters and variablesEric Fiselier2016-12-2317-53/+103
| | | | llvm-svn: 290459
* Fix PR31440: Make __sanitizer_annotate_contigious_container always visible. ↵Eric Fiselier2016-12-231-1/+1
| | | | | | Fix from Jan Beich llvm-svn: 290447
* [CMake] Fix issue reported on sanitizer botsChris Bieneman2016-12-171-1/+1
| | | | | | This should resolve an issue reported on the commit thread that impacted sanitizer bots. llvm-svn: 290052
* [CMake] Put headers relative to clangChris Bieneman2016-12-161-10/+6
| | | | | | | | When libcxx isn't building with an installed LLVM we copy the libcxx headers into the LLVM build directory so that a clang in that build tree can find the headers relative to itself. This is only important in situations where you don't have headers installed under /, which is common these days on Darwin. llvm-svn: 289963
* Revert r289727 due to PR31384Eric Fiselier2016-12-153-150/+36
| | | | | | | | This patch reverts the changes to tuple which fixed construction from types derived from tuple. It breaks the code mentioned in llvm.org/PR31384. I'll follow this commit up with a test case. llvm-svn: 289773
* Fix PR31378 - std::list::remove should not require a default constructible ↵Eric Fiselier2016-12-141-1/+1
| | | | | | | | | | | | allocator. In list::remove we collect the nodes we're removing in a seperate list instance. However we construct this list using the default constructor which default constructs the allocator. However allocators are not required to be default constructible. This patch fixes the construction of the second list. llvm-svn: 289735
* [libcxx] Fix tuple construction/assignment from types derived from ↵Eric Fiselier2016-12-143-36/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tuple/pair/array. Summary: The standard requires tuple have the following constructors: ``` tuple(tuple<OtherTypes...> const&); tuple(tuple<OtherTypes...> &&); tuple(pair<T1, T2> const&); tuple(pair<T1, T2> &&); tuple(array<T, N> const&); tuple(array<T, N> &&); ``` However libc++ implements these as a single constructor with the signature: ``` template <class TupleLike, enable_if_t<__is_tuple_like<TupleLike>::value>> tuple(TupleLike&&); ``` This causes the constructor to reject types derived from tuple-like types; Unlike if we had all of the concrete overloads, because they cause the derived->base conversion in the signature. This patch fixes this issue by detecting derived types and the tuple-like base they are derived from. It does this by creating an overloaded function with signatures for each of tuple/pair/array and checking if the possibly derived type can convert to any of them. This patch fixes [PR17550]( https://llvm.org/bugs/show_bug.cgi?id=17550) This patch Reviewers: mclow.lists, K-ballo, mpark, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27606 llvm-svn: 289727
* [libcxx] Fix PR24075, PR23841 - Add ↵Eric Fiselier2016-12-142-5/+88
| | | | | | | | | | | | | | | | | | | | scoped_allocator_adaptor::construct(pair<T, U>*, ...) overloads. Summary: For more information see: * https://llvm.org/bugs/show_bug.cgi?id=23841 * https://llvm.org/bugs/show_bug.cgi?id=24075 I hope you have as much fun reviewing as I did writing these insane tests! Reviewers: mclow.lists, AlisdairM, EricWF Subscribers: AlisdairM, Potatoswatter, cfe-commits Differential Revision: https://reviews.llvm.org/D27612 llvm-svn: 289710
* Enable the -Wsign-compare warning to better support MSVCEric Fiselier2016-12-111-1/+3
| | | | llvm-svn: 289363
* Fix missing const on set::count. Patch from Andrey KhalyavinEric Fiselier2016-12-091-1/+1
| | | | llvm-svn: 289204
* Fix PR27374 - Remove the implicit reduced-arity-extension in tuple.Eric Fiselier2016-12-081-3/+20
| | | | | | | | | | | | | | | | | | | This patch removes libc++'s tuple extension which allowed it to be constructed from fewer initializers than elements; with the remaining elements being default constructed. However the implicit version of this extension breaks conforming code. For example: int fun(std::string); int fun(std::tuple<std::string, int>); int x = fun("hello"); // ambigious Because existing code may already depend on this extension it can be re-enabled by defining _LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION. Note that the explicit version of this extension is still supported, although it's somewhat less useful than the implicit one. llvm-svn: 289158
* Fix PR30323: numeric_limits<T>::max_digits10 when using 16 bit ints.Eric Fiselier2016-12-081-3/+3
| | | | | | | | | | | | Summary: Also see https://llvm.org/bugs/show_bug.cgi?id=30323 Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27566 llvm-svn: 289029
* Fix _LIBCPP_VERSION tests with modules on DarwinEric Fiselier2016-12-081-5/+8
| | | | llvm-svn: 289028
* Revert r288787: Add missing stdbool.h module.Eric Fiselier2016-12-061-4/+1
| | | | | | | | Reverting because I didn't properly test this patch. Although it's probably correct to add a stdbool_h module I thought the change fixed more than it did. I'll re-commit after more investigation. llvm-svn: 288789
* Add missing stdbool.h module. The test suite now passes on OS X with modulesEric Fiselier2016-12-061-1/+4
| | | | llvm-svn: 288787
* Fix stdio module build on OS XEric Fiselier2016-12-061-0/+2
| | | | llvm-svn: 288778
* Fix C++03 modules buildEric Fiselier2016-12-061-0/+2
| | | | llvm-svn: 288755
* Add module definitions for <experimental/foo> headersEric Fiselier2016-12-051-0/+116
| | | | llvm-svn: 288735
* Add module definitions for string_viewEric Fiselier2016-12-052-0/+12
| | | | llvm-svn: 288733
* Add modules for any/optional/variantEric Fiselier2016-12-051-0/+12
| | | | llvm-svn: 288730
* Adjust libc++ test infastructure to fully support modulesEric Fiselier2016-12-051-1/+1
| | | | | | | | | | | | This patch overhalls the libc++ test format/configuration in order to fully support modules. By "fully support" I mean get almost all of the tests passing. The main hurdle for doing this is handling tests that `#define _LIBCPP_FOO` macros to test a different configuration. This patch deals with these tests in the following ways: 1. For tests that define single `_LIBCPP_ABI_FOO` macros have been annotated with `// MODULES_DEFINES: _LIBCPP_ABI_FOO`. This allows the test suite to define the macro on the command line so it uses a different set of modules. 2. Tests for libc++'s debug mode (which define custom `_LIBCPP_ASSERT`) are automatically detected by the test suite and are compiled and run with modules disabled. This patch also cleans up how the `CXXCompiler` helper class handles enabling/disabling language features. NOTE: This patch uses `LIT` features which were only committed to LLVM today. If this patch breaks running the libc++ tests you probably need to update LLVM. llvm-svn: 288728
* [libc++] Add _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONSShoaib Meenai2016-12-052-8/+36
| | | | | | | | | | | It's useful to be able to disable visibility annotations entirely; for example, if we're building libc++ static to include in another library, and we don't want any libc++ functions getting exported out of that library. This is a generalization of _LIBCPP_DISABLE_DLL_IMPORT_EXPORT. Differential Revision: https://reviews.llvm.org/D26934 llvm-svn: 288690
* Choose better hash values for std::monostate and valueless variants.Eric Fiselier2016-12-041-2/+4
| | | | | | | | | | | Previously these hashes were 0 and -1 respectively. These seem like common sentinel values and should be avoided to prevent needless collisions. This patch changes those values to different arbitrary numbers, which should hopefully cause less collisions. Because I couldn't help myself I choose the fundamental constants for gravity and the speed of light. llvm-svn: 288623
* Make make_exception_ptr abort with -fno-exceptionsEric Fiselier2016-12-031-1/+4
| | | | llvm-svn: 288575
* Fix <variant> w/o exception supportEric Fiselier2016-12-031-2/+12
| | | | llvm-svn: 288571
OpenPOWER on IntegriCloud