summaryrefslogtreecommitdiffstats
path: root/libcxx
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement P0505: 'Wording for GB 50'Marshall Clow2017-01-0412-35/+209
| | | | llvm-svn: 291028
* Use C++11 static_assert in variant tests. Patch from Michael ParkEric Fiselier2017-01-043-32/+32
| | | | llvm-svn: 291021
* [libcxx] Re-implement LWG 2770 again: Fix tuple_size to work with structured ↵Eric Fiselier2017-01-047-36/+334
| | | | | | | | | | | | | | | | | | | bindings Summary: This patch attempts to re-implement a fix for LWG 2770, but not the actual specified PR. The PR for 2770 specifies tuple_size<T const> as only conditionally providing a `::value` member. However C++17 structured bindings require `tuple_size<T const>` to be complete only if `tuple_size<T>` is also complete. Therefore this patch implements only provides the specialization `tuple_size<T CV>` iff `tuple_size<T>` is a complete type. This fixes http://llvm.org/PR31513. Reviewers: mclow.lists, rsmith, mpark Subscribers: mpark, cfe-commits Differential Revision: https://reviews.llvm.org/D28222 llvm-svn: 291019
* Implement the last bit of P0031: 'A Proposal to Add Constexpr Modifiers to ↵Marshall Clow2017-01-046-55/+158
| | | | | | reverse_iterator, move_iterator, array and Range Access' for C++17 llvm-svn: 290976
* fix elast configuration on Windows targetsSaleem Abdulrasool2017-01-041-1/+3
| | | | | | | A typo and missing header inclusion was obscured by the litany of user defined literal warnings. This fixes the detection of ELAST on windows. llvm-svn: 290941
* config: MSVC 19+ has unicode charsSaleem Abdulrasool2017-01-041-0/+2
| | | | | | | MSVC 19+ and clang-cl with emulation version >= 19.00 will provide char{16,32}_t as builtin types. Adjust the configuration accordingly. llvm-svn: 290940
* build: use the platform dependent library prefix/suffixSaleem Abdulrasool2017-01-041-1/+2
| | | | | | | | Use the cmake variables to get the platform dependent values for the static library prefix and suffix, which can be different from the Unix preference for "lib", ".a" (e.g. Windows uses "", ".lib" respectively). llvm-svn: 290939
* build: use more portable spelling for flagSaleem Abdulrasool2017-01-041-2/+3
| | | | | | | Use `CMAKE_LIBRARY_PATH_FLAG` instead of hard-coding it to -L. This silences a warning with cl which expects `/LIBPATH` instead. llvm-svn: 290938
* Refactor bitscan64 checkSaleem Abdulrasool2017-01-042-3/+5
| | | | | | | | Introduce a `_LIBCPP_HAS_BITSCAN64` macro to specify if the 64-bit variant of the bitscan family of APIs is available. This avoids duplicating the check in the support header. llvm-svn: 290924
* [libcxx] [test] Strip trailing whitespace.Stephan T. Lavavej2017-01-045-5/+5
| | | | | | Fixes D27786. llvm-svn: 290922
* [libcxx] [test] Fix recently introduced warnings emitted by MSVC.Stephan T. Lavavej2017-01-044-0/+16
| | | | | | | | | | These tests were using malloc()'s return value without checking for null, which MSVC's /analyze rightly warns about. Asserting that the pointer is non-null both expresses the test's intention and silences the warning. Fixes D27785. llvm-svn: 290921
* clean up use of _WIN32Saleem Abdulrasool2017-01-0310-39/+48
| | | | | | | | | Replace the use of _WIN32 in libc++. Replace most use with a C runtime check _LIBCPP_MSVCRT or the new _LIBCPP_WIN32 to indicate that we are using the Win32 API. Use a new _LIBCPP_WCHAR_IS_UCS2 to indicate that we are on an environment that has a short wchar_t. llvm-svn: 290910
* [libcxx] Add build/test support for the externally threaded libc++abi variantAsiri Rathnayake2017-01-035-19/+53
| | | | | | | Differential revision: https://reviews.llvm.org/D27576 Reviewers: EricWF llvm-svn: 290889
* [libcxx] Fix testing of the externally-threaded library buildAsiri Rathnayake2017-01-032-4/+18
| | | | | | | | | | | | | | | | | | | | after r290850 Before r290850, building libcxx with -DLIBCXX_HAS_EXTERNAL_THREAD_API=ON had two uses: - Allow platform vendors to plug-in an __external_threading header which should take care of the entire threading infrastructure of libcxx - Allow testing of an externally-threaded library build; where the thread API is declared using pthread data structures, and the implementation of this API is provided as a separate library (test/support/external_threads.cpp) and linked-in when running the test suite. r290850 breaks the second use case (pthread data structures are no longer available). This patch re-stores the ability to build+test an externally-threaded library variant on a pthread based system. llvm-svn: 290878
* Update year to 2017Eric Fiselier2017-01-033-3/+3
| | | | llvm-svn: 290876
* Simplify CMake target for the __generated_config headerEric Fiselier2017-01-031-4/+1
| | | | llvm-svn: 290875
* clang-format: tweak configurationSaleem Abdulrasool2017-01-031-0/+6
| | | | | | | | Update the configuration to reflect the style more accurately. Pointers are tied to the left. Braces are split on classes/structs and functions. llvm-svn: 290857
* build: remove now unused UNIX_CATSaleem Abdulrasool2017-01-031-4/+0
| | | | | | | THe previous change replaced the use of `cat` or `type` with a custom python script. Remove the now unused command determining. llvm-svn: 290856
* Fix creating __generated_config on WindowsEric Fiselier2017-01-032-2/+53
| | | | llvm-svn: 290853
* system_error: provide a thread safe stringification for WindowsSaleem Abdulrasool2017-01-031-2/+10
| | | | | | | Provide a strerror_r replacement for Windows. This is needed to build libc++ for Windows with threading. llvm-svn: 290851
* threading_support: refactor for Win32 threadingSaleem Abdulrasool2017-01-032-82/+114
| | | | | | | | | Refactor the header to allow us to implement alternate threading models with alternate data structures. Take the opportunity to clang-format the area. This will allow us to avoid re-declaring the interfaces for Win32 threading. NFC llvm-svn: 290850
* Recommit r290839 - Fix configuring and building libc++ w/o an ABI library.Eric Fiselier2017-01-039-19/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch re-commits a previous attempt to support building libc++ w/o an ABI library. That patch was originally reverted because: 1) It forgot to teach the test suite about "default" ABI libraries. 2) Some LLVM builders don't clear the CMake cache between builds. The previous patch caused those builders to fail since their old cache entry for LIBCXX_CXX_ABI="" is no longer valid. The updated patch addresses both issues. It works around (2) by adding a hack to force the builders to update their cache entries. The hack will be removed shortly once all LLVM builders have run. Original commit message ----------------------- Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits of the C++ STL. However we also support building w/o an ABI library entirely. This patch fixes building libc++ w/o an ABI library (and incorporates the `~type_info()` fix in D28211). The main changes in this patch are: 1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default". 2) Fix CMake bits which treated "none" as "default" on OS X. 3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`. 4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined. Unfortunately this patch doesn't help clean up the macro mess that we use to configure for different ABI libraries. llvm-svn: 290849
* Re-implement LWG 2770 - Fix tuple_size with structured bindings.Eric Fiselier2017-01-025-29/+34
| | | | | | | This patch implements the correct PR for LWG 2770. It also makes the primary tuple_size template incomplete again which fixes part of llvm.org/PR31513. llvm-svn: 290846
* Fix use of throw(...) spec with GCC in C++17Eric Fiselier2017-01-021-1/+1
| | | | llvm-svn: 290845
* Revert r290839 - Fix configuring and building libc++ w/o an ABI libraryEric Fiselier2017-01-028-32/+16
| | | | llvm-svn: 290841
* Introduce _LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR ABI option.Eric Fiselier2017-01-023-1/+8
| | | | | | | | | | | | | Currently libc++ compiles a special version of error_category() into the dylib. This definition is no longer needed, and doesn't work on Windows due to dllimport/dllexport semantics. For those reasons this patch introduces an option to disable/enable this definition. By default the definition is provided in ABI v1 except on windows. This patch also addresses D28210. llvm-svn: 290840
* Fix configuring and building libc++ w/o an ABI library.Eric Fiselier2017-01-028-16/+32
| | | | | | | | | | | | | | | | | | | Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits of the C++ STL. However we also support building w/o an ABI library entirely. This patch fixes building libc++ w/o an ABI library (and incorporates the `~type_info()` fix in D28211). The main changes in this patch are: 1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default". 2) Fix CMake bits which treated "none" as "default" on OS X. 3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`. 4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined. Unfortunately this patch doesn't help clean up the macro mess that we use to configure for different ABI libraries. llvm-svn: 290839
* build: tweak macros for Windows buildSaleem Abdulrasool2017-01-022-3/+22
| | | | | | | | | | | Move the windows specific macro definitions for compiling c++ into the target. Add a number of newer options that are necessary to properly build libc++ for windows. This ensures that we do not accidentally autolink msvcprt (Microsoft's C++ runtime library), do not define linker pragmas which are msvcprt specific, and do not accidentally encode the incorrect version of the msvc compatibility version. llvm-svn: 290837
* build: make cross-compiling to Windows work on LinuxSaleem Abdulrasool2017-01-021-0/+7
| | | | | | | | | Disable the manifest bundling on Windows when cross-compiling on not-Windows. With this, it is possible to execute the link command from CMake which will use cmake to invoke the manifest tool to generate a manifest and pass that to the linker. llvm-svn: 290836
* win32: temporarily disable setting locale on 14+Saleem Abdulrasool2017-01-021-0/+4
| | | | | | | | | | The locale structures have been made opaque in CRT 14+. This currently prevents building libc++ for Windows. We can re-enable this in the future when we have replicated the structure to access the private field for the name (unless there exists a better supported mechanism to query the name of a locale given the locale_t). llvm-svn: 290835
* Rework fix for PR19460 - Use explicit bool as an extension instead.Eric Fiselier2017-01-023-19/+7
| | | | | | | | | | | | | | | | | | | | | | | | | In the previous fix I used a PMF type as a semi-safe bool type in C++03. However immediately after committing I realized clang offered explicit conversion operators as an extension. This patch removes the old fix and enables _LIBCPP_EXPLICIT using __has_extension instead. This change also affects the following other classes, which have '_LIBCPP_EXPLICIT operator bool()'. * shared_ptr * unique_ptr * error_condition * basic_ios * function (already C++11 only) * istream::sentry * experimental::string_view. In all of the above cases I believe it is safe to enable the extension, except in the experimental::string_view case. There seem to be some Clang bugs affecting the experimental::string_view conversion to std::basic_string. To work around that I manually disabled _LIBCPP_EXPLICIT in that case. llvm-svn: 290831
* chrono: correct the units for the epoch biasSaleem Abdulrasool2017-01-021-2/+1
| | | | | | | | As pointed out by Howard, this is actually 134774 days (* 24 * 3600), and therefore seconds, not 100ns units. Adjust the units to reflect reality. llvm-svn: 290824
* locale: update ctype access for MSVC CRT 14+Saleem Abdulrasool2017-01-022-3/+14
| | | | | | | | | | | Visual C++ 14 and newer split msvcrt into msvcrt and ucrt with flavours of the ucrt for different environments. This changed the access to the ctype table by introducing the `__pctype_func` and `__pwctype_func` accessors. Use this rather than directly accessing `_ctype` which allows us to be safer in threaded situations by going through the libc locking. llvm-svn: 290823
* chrono: address post commit comments from HowardSaleem Abdulrasool2017-01-011-13/+17
| | | | | | | | | | | | | | | | | Drawing some inspiration from code from Bill O'Neal as pointed out by Howard, rework the code to avoid an overflow in the duration. Adjust the style to match libc++ style as well. Create a local typedef for the FILETIME duration (100-ns units). Use this to define the difference between the NT and the UNIX epochs (which previously overflowed due to the representation limits due to the bouncing to ns). Return the FILETIME duration biased by the NT-to-UNIX epoch conversion. Use of the custom duration makes it easier to read and reason about the code. llvm-svn: 290806
* chrono: address post-commit comments from majnemerSaleem Abdulrasool2017-01-011-8/+8
| | | | | | | Correct style to match libc++ style as pointed out by David Majnemer on IRC. NFC. llvm-svn: 290805
* chrono: give Windows a steady_clockSaleem Abdulrasool2017-01-011-14/+29
| | | | | | | Provide a definition for a steady monotonic clock by wrapping QueryPerformanceCounter. llvm-svn: 290804
* chrono: implement a Windows version of system_clock::nowSaleem Abdulrasool2017-01-011-0/+32
| | | | | | | | | | | | | | system_clock::now is not entirely straight forward on Windows, which does not have a clock_gettime function. GetSystemTimeAsFileTime gives us the value relative to the NT epoch (Jan 1 1601) rather than the Unix epoch (Jan 1 1970). However, this function has a low resolution (~10ms). Newer versions of Windows provide GetSystemTimePreciseAsFileTime which gives us a much more accurate time (<1us). Unfortunately, the latter is only available on Windows 8+ when targeting desktop apps. llvm-svn: 290803
* build: further improve flags handling for clSaleem Abdulrasool2017-01-011-7/+13
| | | | | | | | | This allows us to build with cl (or rather clang-cl) by using the correct spelling for `-include` (`/FI` for cl). clang-cl and cl default to C++11/C++14 as they support it rather than permitting an explicit language standard. llvm-svn: 290802
* build: dont detect libraries for WindowsSaleem Abdulrasool2017-01-011-6/+27
| | | | | | | | | Hard code the defaults for Windows for the time being. The checks really are always going to return the same value. Technically, the pthread linkage is possible, however, it seems better to use the Win32 threading along with the external threading support that we have added. llvm-svn: 290801
* 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
* system_error: use strerror_r only for threaded codeSaleem Abdulrasool2016-12-311-0/+2
| | | | | | | | When building libc++ without threading, strerror_r is not used. Define the code only when threading is enabled. This allows us to build system_error for Windows, which ATM doesn't build with threading. llvm-svn: 290791
* 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
* random: include __config before buildingSaleem Abdulrasool2016-12-311-0/+2
| | | | | | | We need to include __config to ensure that we know what random implementation is being used. Fixes compilation for Windows. llvm-svn: 290775
* improve performance of string::findSebastian Pop2016-12-302-6/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix some 'FIXME's in the tests.Marshall Clow2016-12-304-18/+10
| | | | llvm-svn: 290758
* Recommit r290750: Fix PR19460 - std::ios is convertible to int.Eric Fiselier2016-12-303-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-302-24/+2
| | | | llvm-svn: 290752
* Add missing include in test.Eric Fiselier2016-12-301-0/+2
| | | | llvm-svn: 290751
* Fix PR19460 - std::ios is convertible to int.Eric Fiselier2016-12-302-2/+22
| | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud