summaryrefslogtreecommitdiffstats
path: root/libcxx
Commit message (Collapse)AuthorAgeFilesLines
* Update test to better check for the non-constexpr-ness of a move ↵Marshall Clow2019-04-251-5/+20
| | | | | | constructor. Fixes PR#41577. llvm-svn: 359162
* Use modern type trait implementations when available.Richard Smith2019-04-252-14/+45
| | | | | | | | | | | | | | Teach libcxx to stop using various deprecated __has_* type traits, in favor of the ("modern", C++11 era) __is_* type traits. This is mostly just a simplification, but fixes at least one bug: _Atomic T should be considered trivially-destructible, but is not considered to be POD by Clang, and __has_trivial_destructor is specified in the GCC documentation as returning false for non-POD non-class types. Differential Revision: https://reviews.llvm.org/D48292 llvm-svn: 359159
* Add std::is_constant_evaluated.Eric Fiselier2019-04-2410-10/+103
| | | | | | | | | Clang recently added __builtin_is_constant_evaluated() and GCC 9.0 has it as well. This patch adds support for it in libc++. llvm-svn: 359119
* Make the test object callable. libstdc++'s bind checks that (libc++ ↵Marshall Clow2019-04-241-1/+1
| | | | | | currently does not). Thanks to Jonathan Wakely for the fix. llvm-svn: 359108
* Fix a one more compare test that assumed -1/0/1 instsad of <0/0/>0. NFC.Marshall Clow2019-04-241-1/+1
| | | | llvm-svn: 359106
* Fix a couple of tests that assumed that compare retunred -1/0/1 instead of ↵Marshall Clow2019-04-244-7/+7
| | | | | | <0/0/>0. Thanks to Jonathan Wakely for the report. llvm-svn: 359104
* Add an any_cast test for array types. Thanks to Jonathan Wakely for the ↵Marshall Clow2019-04-242-8/+25
| | | | | | suggestion. llvm-svn: 359085
* Avoid name conflict with kernel headersEric Fiselier2019-04-244-9/+12
| | | | llvm-svn: 359080
* [libcxx] Use relative path for libc++ library when generating scriptPetr Hosek2019-04-231-1/+4
| | | | | | | | | This addresses the issue introduced in D60309 which leads to linker scripts being generated with absolute paths. Differential Revision: https://reviews.llvm.org/D61039 llvm-svn: 359045
* Fix namespace name conflict with GCCEric Fiselier2019-04-236-55/+55
| | | | llvm-svn: 359023
* Fix implementation of ::abs and std::abs LWG 2192.Eric Fiselier2019-04-237-52/+242
| | | | | | | | | | | | | | | | | | | Summary: All overloads of `::abs` and `std::abs` must be present in both `<cmath>` and `<cstdlib>`. This is problematic to implement because C defines `fabs` in `math.h` and `labs` in `stdlib.h`. This introduces a circular dependency between the two headers. This patch implements that requirement by moving `abs` into `math.h` and making `stdlib.h` include `math.h`. In order to get the underlying C declarations from the "real" `stdlib.h` inside our `math.h` we need some trickery. Specifically we need to make `stdlib.h` include next itself. Suggestions for a cleaner implementation are welcome. Reviewers: mclow.lists, ldionne Reviewed By: ldionne Subscribers: krytarowski, fedor.sergeev, dexonsmith, jdoerfert, jsji, libcxx-commits Differential Revision: https://reviews.llvm.org/D60097 llvm-svn: 359020
* [libc++] Remove redundant conditionals for Apple platformsLouis Dionne2019-04-233-8/+6
| | | | | | | | | | | | | | | | | | | Summary: In a bunch of places, we used to check whether LIBCXX_BUILDING_LIBCXXABI is defined OR we're building for an Apple platform. This used to be necessary in a time when Apple's build script did NOT define LIBCXX_BUILDING_LIBCXXABI. However this is not relevant anymore since Apple's build does define LIBCXX_BUILDING_LIBCXXABI. Reviewers: EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D60842 llvm-svn: 358988
* [libcxx] Update gen_link_script.py to support different input and outputPetr Hosek2019-04-222-62/+34
| | | | | | | | | | This enables the use of this script from other build systems like GN which don't support post-build actions as well as for static archives. Differential Revision: https://reviews.llvm.org/D60309 llvm-svn: 358915
* [libc++][test] Update some wstring_convert tests for MSVC quirksCasey Carter2019-04-223-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to MSVC's decision to encode `wchar_t` as UTF-16, it rejects wide character/string literals that expect a character value greater than `\xffff`. UTF-16 `wchar_t` is clearly non-conforming, given that the standard requires wchar_t to be capable of representing all characters in the supported wide character execution sets, but rejecting e.g. `\x40003` is a reasonably sane compromise given that encoding choice: there's an expectation that `\xFOO` produces a single character in the resulting literal. Consequently `L'\x40003'`/`L"\x40003"` are ill-formed literals on MSVC. `L'\U00040003'` is a high surrogate (and produces a warning about ignoring the "second character" in a multi-character literal), and `L"\U00040003"` is a perfectly-valid `const wchar_t[3]`. This change updates these tests to use universal-character-names instead of raw values for the intended character values, which technically makes them portable even to implementations that don't use a unicode transformation format encoding for their wide character execution character set. The two-character literal `L"\u1005e"` is awkward - the `e` looks like part of the UCN's hex encoding - but necessary to compile in '03 mode since '03 didn't allow UCNs to be used for members of the basic execution character set even in character/string literals. I've also eliminated the extraneous `\x00` "bonus null-terminator" in some of the string literals which doesn't affect the tested behavior. I'm sorry about using `*L"\U00040003"` in `conversions.string/to_bytes.pass.cpp`, but it's correct for platforms with 32-bit wchar_t, *and* doesn't trigger narrowing warnings as did the prior `CharT(0x40003)`. Differential Revision: https://reviews.llvm.org/D60950 llvm-svn: 358908
* [libc++] [test] Silence C++20 deprecation warnings in the MSVC STLCasey Carter2019-04-191-1/+2
| | | | | | ... when including msvc_stdlib_force_include.hpp. llvm-svn: 358782
* [libc++] Make __debug_less::operator() constexprThomas Anderson2019-04-192-0/+14
| | | | | | | | | | | | | | This is a followup to [1] which added a new `__debug_less::operator()` overload. [2] added `_LIBCPP_CONSTEXPR_AFTER_CXX17` to the original `__debug_less::operator()` between the time of writing [1] and landing it. This change adds `_LIBCPP_CONSTEXPR_AFTER_CXX17` to the new overload too. [1] https://reviews.llvm.org/rL358423 [2] https://reviews.llvm.org/rL358252 Differential Revision: https://reviews.llvm.org/D60724 llvm-svn: 358725
* [libc++] Link against libc++abi in the libc++abi testsLouis Dionne2019-04-181-1/+5
| | | | | | PR27405 llvm-svn: 358712
* [libc++] [test] Add missing required headers to midpoint.integer.pass.cppBilly Robert O'Neal III2019-04-181-0/+2
| | | | | | This change authored by Paolo Torres <t-pator@microsoft.com> llvm-svn: 358698
* [libc++] Make sure we re-export some missing libc++abi symbols from libc++Louis Dionne2019-04-184-9/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Ensure we re-export __cxa_throw_bad_array_new_length and __cxa_uncaught_exceptions from libc++, since they are now provided by libc++abi. Doing this allows us to stop linking explicitly against libc++abi in the libc++abi tests, since libc++ re-exports all the necessary symbols. However, there is one caveat to that. We don't want libc++ to re-export __cxa_uncaught_exception (the singular form), since it's only provided for backwards compatibility. Hence, for the single test where we check this backwards compatibility, we explicitly link against libc++abi. PR27405 PR22654 Reviewers: EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D60424 llvm-svn: 358690
* [libc++] Unconditionally enable the __pad_and_output optimizationLouis Dionne2019-04-182-11/+0
| | | | | | | | | | This used to be guarded on whether the deployment target was greater than macosx10.8, however testing against the dylibs for 10.8 and earlier with the function enabled works too. The revision that introduced __pad_and_output is r164241 and it does not mention a reason for the guard. llvm-svn: 358677
* [libc++][CMake] Always provide new/delete in libc++ unless specified otherwiseLouis Dionne2019-04-181-12/+2
| | | | | | | | | | | | | | | | | | Summary: Let's not try to be clever and detect it based on the libc++abi setting. The only build that puts new/delete in libc++abi is Apple's and we set this CMake option explicitly in both libc++ and libc++abi. Complicated dependent options hurt, let's avoid them when possible. Reviewers: phosek, EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D60797 llvm-svn: 358671
* [libc++][CMake] Remove unnecessary conditional for defining new handlersLouis Dionne2019-04-171-1/+1
| | | | | | | | | | | It turns out that whether the new handlers should be provided is orthogonal to whether new/delete are provided in libc++ or libc++abi. The reason why I initially added this conditional is because of an incorrect understanding of the path we're taking when building on Apple platforms. In fact, we always build libc++ on top of libc++abi on Apple platforms, so we take the branch for `LIBCXX_BUILDING_LIBCXXABI` there. llvm-svn: 358616
* [CMake] Split linked libraries for shared and static libc++Petr Hosek2019-04-172-19/+13
| | | | | | | | | | | | | Some linker libraries are only needed for shared libc++, some only for static libc++, combining these together in LIBCXX_LIBRARIES and LIBCXX_INTERFACE_LIBRARIES can introduce unnecessary dependencies. This changes splits those up into LIBCXX_SHARED_LIBRARIES and LIBCXX_STATIC_LIBRARIES matching what libc++abi already does. Differential Revision: https://reviews.llvm.org/D57872 llvm-svn: 358614
* [libc++] (Take 2) Add a test that uses the debug database from multiple threadsLouis Dionne2019-04-171-0/+72
| | | | | | | | | | | | In r358591, I added a test that uses the debug database from multiple threads and that helped us uncover the problem that was fixed in r355367. However, the test broke the tsan CI bots, and I think the problem is the test allocator that was used in the test (which is not thread safe). I'm committing again without using the test allocator, and in a separate test file. llvm-svn: 358610
* [libc++][CMake] Allow building neither the shared nor the static libraryLouis Dionne2019-04-171-4/+0
| | | | | | It's possible to build just the headers, and we actually do it. llvm-svn: 358608
* [libc++] Use the no_destroy attribute to avoid destroying debug DB staticsLouis Dionne2019-04-172-2/+8
| | | | | | | | | | | | | | | | | Summary: Otherwise, we can run into problems when the program has static variables that need to use the debug database during their deinitialization, if the debug DB has already been deinitialized. Reviewers: EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D60830 llvm-svn: 358602
* Revert "[libc++] Add a test that uses the debug database from multiple threads"Louis Dionne2019-04-171-34/+0
| | | | | | | | This reverts r358591, which seems to have uncovered an actual bug and causes the tsan CI to fail. We need to fix the bug and re-commit the test. llvm-svn: 358593
* [libc++] Add a test that uses the debug database from multiple threadsLouis Dionne2019-04-171-0/+34
| | | | | | | This test helped us concurrently discover the problem that was fixed in r355367. llvm-svn: 358591
* [libc++][NFC] Make size of allocation more self-documentingLouis Dionne2019-04-171-2/+2
| | | | llvm-svn: 358588
* Fix visibility for coroutine types on WindowsEric Fiselier2019-04-171-3/+3
| | | | llvm-svn: 358551
* Add tests for stability to list::sort and forward_list::sort. Thanks to ↵Marshall Clow2019-04-174-0/+184
| | | | | | Jonathan Wakely for the notice llvm-svn: 358541
* Fix list/forward_list implementations of remove_if and unique to deal with ↵Marshall Clow2019-04-166-6/+107
| | | | | | predicates that are part of the sequence passed in. We already do this for remove. llvm-svn: 358534
* [NFC] Build libc++ verbosely in the macOS CILouis Dionne2019-04-161-2/+2
| | | | llvm-svn: 358529
* [libc++] Make sure we use new/delete from libc++abi on CI for Apple platformsLouis Dionne2019-04-161-0/+2
| | | | llvm-svn: 358524
* [libc++] Remove old workaround for builditLouis Dionne2019-04-161-6/+2
| | | | | | | | | | | | | | | | | | | | Summary: I'm not sure what the problem was at the time, however I don't think this is necessary since buildit doesn't exist anymore. Instead of the workaround, the correct thing to do is to leave out the get_new_handler/set_new_handler definitions from libc++ when we're getting them from libc++abi. Reviewers: EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D60717 llvm-svn: 358518
* [libc++] Fix debug_less test in C++03Louis Dionne2019-04-151-9/+9
| | | | | | We were using C++11 features but the test needs to work in C++03 too. llvm-svn: 358433
* [libc++] Fix build failure with _LIBCPP_DEBUG=0 when iterators return values ↵Thomas Anderson2019-04-152-0/+44
| | | | | | | | | | | | | | | | | | | instead of references There are many STL algorithms (such as lexicographical_compare) that compare values pointed to by iterators like so: __comp(*it1, *it2); When building with `_LIBCPP_DEBUG=0`, comparators are wrapped in `__debug_less` which does some additional validation. But `__debug_less::operator()` takes non-const references, so if the type of `*it1` is int, not int&, then the build will fail. This change adds a `const&` overload for `operator()` to fix the build. Differential Revision: https://reviews.llvm.org/D60592 llvm-svn: 358423
* [NFC] Add missing revision number in libc++ ABI changelogLouis Dionne2019-04-151-1/+1
| | | | llvm-svn: 358411
* [libc++] Make sure that the symbol differ takes into account symbol typesLouis Dionne2019-04-151-3/+3
| | | | | | | | | | | | | | | | | Summary: Otherwise, it doesn't take into account things like whether the symbol is defined or undefined, and whether symbols are indirect references (re-exports) or not. Reviewers: EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D60416 llvm-svn: 358408
* [libc++] Run back-deployment CI against previously-released libc++abi dylibsLouis Dionne2019-04-123-7/+3
| | | | | | | | | | | We used to do it against the current system's libc++abi, which is not as good as doing it with the libc++abi that matches the libc++ we're running against. Note that I made sure we were indeed picking up the provided libc++abi by replacing it by something that doesn't work and watching it burn. llvm-svn: 358294
* Cleanup how debug comparators are created in <algorithm>Eric Fiselier2019-04-121-151/+38
| | | | | | | | | | Instead of having an `#if` block in every algorithm using a debug comparator, this patch introduces the __comp_ref_type trait that selects __debug_less in debug mode and _Comp& otherwise. This patch should have no observable functionality change. llvm-svn: 358252
* [libc++] Make sure we don't eagerly diagnose non-const comparators for ↵Louis Dionne2019-04-1110-21/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | containers of incomplete types Summary: In r348529, I improved the library-defined diagnostic for using containers with a non-const comparator/hasher. However, the check is now performed too early, which leads to the diagnostic being emitted in cases where it shouldn't. See PR41360 for details. This patch moves the diagnostic to the destructor of the containers, which means that the diagnostic will only be emitted when the container is instantiated at a point where the comparator and the key/value are required to be complete. We still retain better diagnostics than before r348529, because the diagnostics are performed in the containers themselves instead of __tree and __hash_table. As a drive-by fix, I improved the diagnostic to mention that we can't find a _viable_ const call operator, as suggested by EricWF in PR41360. Reviewers: EricWF, mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits, zoecarver Tags: #libc Differential Revision: https://reviews.llvm.org/D60540 llvm-svn: 358189
* Remove repeated words from BuildingLibcxx.rstJonathan Metzman2019-04-101-1/+1
| | | | | | | | | | | | | | Summary: Remove repeated words from docs. Reviewers: phosek Reviewed By: phosek Subscribers: christof Differential Revision: https://reviews.llvm.org/D60530 llvm-svn: 358147
* [CMake] Fix statically linking in libcxxabi if built separatelyMartin Storsjo2019-04-091-2/+2
| | | | | | | | | | | In this case, CMake doesn't know about the c++abi target within the same CMake run. This reverts this aspect back to how it was before SVN r357811. Differential Revision: https://reviews.llvm.org/D60448 llvm-svn: 358009
* [libc++] Remove install_name and compatibility_version on OS XLouis Dionne2019-04-081-2/+0
| | | | | | | | | | | | | | | CMake already specifies those, and we never actually want those to be used. In fact, r357811 re-ordered those flags in a way that the explicitly-provided install_name was overriding the CMake-provided install_name (instead of the other way around). This caused the dylib to be considered a system dylib, and hence the explicitly provided rpath to be ignored. This, in turn, caused some unit tests to start linking against the system libc++.dylib instead of the freshly-built one. Specifically, the unit tests that started linking against the system dylib are those that didn't specify a DYLD_LIBRARY_PATH, such as last_write_time.sh.cpp. llvm-svn: 357946
* [libc++][CMake] Make sure the benchmarks link against libc++abiLouis Dionne2019-04-051-1/+2
| | | | | | | | | | | | | | The refactoring in r357811 made it so that we didn't add the ABI library to the list of LIBCXX_LIBRARIES. As a result, benchmarks didn't link to the ABI library and were missing symbols. This broke the build bots. As a drive-by fix, we also provide the SHARED ABI library to the linker script instead of the STATIC ABI library. This couldn't be discovered on Apple platforms because libc++.dylib re-exports libc++abi.dylib symbols there. llvm-svn: 357818
* [libc++] Localize CMake code only related to the shared libraryLouis Dionne2019-04-051-68/+64
| | | | | | | | | | | | | | | | | | Summary: There's a lot of CMake logic that's only relevant to the shared library, yet it was using a code path and setting variables that impact both the shared and the static libraries. This patch moves this logic so that it clearly only impacts the shared library. Reviewers: phosek, smeenai, EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D60276 llvm-svn: 357811
* [libc++] Add XFAILs for istream tests that were added in r357775Louis Dionne2019-04-0521-0/+143
| | | | | | | | We fixed incorrect behavior of input streams in r357775 and tests were added accordingly. However, older versions of macOS don't have the change in the dylib yet, so the tests fail on those platforms. llvm-svn: 357794
* [libc++] Fix error flags and exceptions propagated from input stream operationsLouis Dionne2019-04-0542-533/+2480
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is a re-application of r357533 and r357531. They had been reverted because we thought the commits broke the LLDB data formatters, but it turns out this was because only r357531 had been included in the CI run. Before this patch, we would only ever throw an exception if the badbit was set on the stream. The Standard is currently very unclear on how exceptions should be propagated and what error flags should be set by the input stream operations. This commit changes libc++ to behave under a different (but valid) interpretation of the Standard. This interpretation of the Standard matches what other implementations are doing. This effectively implements the wording in p1264r0. It hasn't been voted into the Standard yet, however there is wide agreement that the fix is correct and it's just a matter of time before the fix is standardized. PR21586 PR15949 rdar://problem/15347558 Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D49863 llvm-svn: 357775
* Handle TLS values in sym_checkEric Fiselier2019-04-041-1/+1
| | | | llvm-svn: 357705
OpenPOWER on IntegriCloud