summaryrefslogtreecommitdiffstats
path: root/libcxx
Commit message (Collapse)AuthorAgeFilesLines
...
* libcxx: Define __STDCPP_THREADS__ to 1, not to __cplusplus.Nico Weber2019-07-303-5/+11
| | | | | | | | | | | | | | | | | | | [cpp.predefined]p2: __STDCPP_THREADS__ Defined, and has the value integer literal 1, if and only if a program can have more than one thread of execution . Also define it only if it's not defined already, since it's supposed to be defined by the compiler. Also move it from thread to __config (which requires setting it only if _LIBCPP_HAS_NO_THREADS is not defined). Part of PR33230. The intent is to eventually make the compiler define this instead. llvm-svn: 367316
* Fix tests with modules enabledEric Fiselier2019-07-297-0/+7
| | | | llvm-svn: 367268
* Ensure __config_site definitions are passed to modules tests.Eric Fiselier2019-07-291-8/+7
| | | | | | | | | | | | The test configuration contained a bug where we only raised the __config_site commands to the command line if modules were enabled for all of the libc++ tests. However there are special modules-only tests, and these tests weren't getting the correct defines. This patch corrects that issue. llvm-svn: 367267
* Fix PR35637: suboptimal codegen for `vector<unsigned char>`.Eric Fiselier2019-07-283-95/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The optimizer is petulant and temperamental. In this case LLVM failed to lower the the "insert at end" loop used by`vector<unsigned char>` to a `memset` despite `memset` being substantially faster over a range of bytes. LLVM has the ability to lower loops to `memset` whet appropriate, but the odd nature of libc++'s loops prevented the optimization from taking places. This patch addresses the issue by rewriting the loops from the form `do [ ... --__n; } while (__n > 0);` to instead use a for loop over a pointer range (For example: `for (auto *__i = ...; __i < __e; ++__i)`). This patch also rewrites the asan annotations to unposion all additional memory at the start of the loop instead of once per iterations. This could potentially permit false negatives where the constructor of element N attempts to access element N + 1 during its construction. The before and after results for the `BM_ConstructSize/vector_byte/5140480_mean` benchmark (run 5 times) are: -------------------------------------------------------------------------------------------- Benchmark Time CPU Iterations -------------------------------------------------------------------------------------------- Before ------ BM_ConstructSize/vector_byte/5140480_mean 12530140 ns 12469693 ns N/A BM_ConstructSize/vector_byte/5140480_median 12512818 ns 12445571 ns N/A BM_ConstructSize/vector_byte/5140480_stddev 106224 ns 107907 ns 5 ----- After ----- BM_ConstructSize/vector_byte/5140480_mean 167285 ns 166500 ns N/A BM_ConstructSize/vector_byte/5140480_median 166749 ns 166069 ns N/A BM_ConstructSize/vector_byte/5140480_stddev 3242 ns 3184 ns 5 llvm-svn: 367183
* Fix a bug in std::chrono::abs where it would fail when the duration's period ↵Marshall Clow2019-07-262-1/+7
| | | | | | had not been reduced.s llvm-svn: 367120
* [NFC][libcxx] Add comments about making mutex/condition_variable trivial on ↵Louis Dionne2019-07-251-3/+13
| | | | | | | | | Apple platforms Leaving some comments behind so that we avoid re-having that discussion in the future. llvm-svn: 367048
* Implement change #4 of P1466: Change weekday to accept both 0 and 7 as ↵Marshall Clow2019-07-2520-66/+162
| | | | | | Sunday. Add accessors 'c_encoding' and 'iso_encoding' to provide different interpretations of the weekday. Remove 'operator unsigned' llvm-svn: 366981
* [AIX][lit] Don't depend on psutil on AIXDavid Tenty2019-07-241-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: On AIX psutil can run into problems with permissions to read the process tree, which causes problems for python timeout tests which need to kill off a test and it's children. This patch adds a workaround by invoking shell via subprocess and using a platform specific option to ps to list all the descendant processes so we can kill them. We add some checks so lit can tell whether timeout tests are supported with out exposing whether we are utilizing the psutil implementation or the alternative. Reviewers: hubert.reinterpretcast, andusy, davide, delcypher Reviewed By: delcypher Subscribers: davide, delcypher, christof, lldb-commits, libcxx-commits, llvm-commits Tags: #lldb, #libc, #llvm Differential Revision: https://reviews.llvm.org/D64251 llvm-svn: 366912
* [RISCV] Implement benchmark::cycleclock::NowRoger Ferrer Ibanez2019-07-242-0/+21
| | | | | | | | | This is a cherrypick of D64237 onto llvm/utils/benchmark and libcxx/utils/google-benchmark. Differential Revision: https://reviews.llvm.org/D65142 llvm-svn: 366868
* Implement most of P1612R1: Relocate endian. Moves the std::endian ↵Marshall Clow2019-07-233-16/+23
| | | | | | functionality from 'type-traits' to 'bit'. No other change. The reason that this is 'partial' is that P1621 also recommends a feature-test macro, but I don't have the value for that one yet. In a month or so, I'll add that llvm-svn: 366776
* [NFC][libc++] Add missing EXPLICIT to pair and tuple synopsisLouis Dionne2019-07-222-16/+16
| | | | | | | The constructors for std::pair and std::tuple have been made conditionally explicit, however the synopsis in the headers do not reflect that. llvm-svn: 366735
* [runtimes] Don't depend on libpthread on AndroidYi Kong2019-07-2210-10/+10
| | | | | | | | | | r362048 added support for ELF dependent libraries, but broke Android build since Android does not have libpthread. Remove the dependency on the Android build. Differential Revision: https://reviews.llvm.org/D65098 llvm-svn: 366734
* [libc++] Set __file_ to 0 in basic_filebuf::close() even if fclose failsPetr Hosek2019-07-222-3/+58
| | | | | | | | | | | | | | | | | | | | This issue was detected by ASan in one of our tests. This test manually invokes basic_filebuf::cloe(). fclose(__h.release() returned a non-zero exit status, so __file_ wasn't set to 0. Later when basic_filebuf destructor ran, we would enter the if (__file_) block again leading to heap-use-after-free error. The POSIX specification for fclose says that independently of the return value, fclose closes the underlying file descriptor and any further access (including another call to fclose()) to the stream results in undefined behavior. This is exactly what happened in our test case. To avoid this issue, we have to always set __file_ to 0 independently of the fclose return value. Differential Revision: https://reviews.llvm.org/D64979 llvm-svn: 366730
* [libc++] Do not infer support for C++17 in GCC < 7Louis Dionne2019-07-221-0/+1
| | | | | | | | | | | | | | | | | | libc++'s lit configuration infers the C++ language dialect when it is not provided by checking which -std= flags that a compiler supports. GCC 5 and GCC 6 have a -std=c++17 flag, however, they do not have full C++17 support. The lit configuration has hardcoded logic that removes -std=c++1z as an option to test for GCC < 7, but not -std=c++17. This leads to a bunch of failures when running libc++ tests with GCC 5 or GCC 6. This patch adds -std=c++17 to the list of flags that are discarded for GCC < 7 by lit's language dialect inference. Thanks to Bryce Adelstein Lelbach for the patch. Differential Revision: https://reviews.llvm.org/D62874 llvm-svn: 366700
* Update c++2a status page with post-Cologne informationMarshall Clow2019-07-221-1/+57
| | | | llvm-svn: 366696
* [libc++] Mark libcpp_deallocate.sh.cpp as UNSUPPORTED instead of XFAIL on ↵Louis Dionne2019-07-191-1/+1
| | | | | | | | | | AppleClang 9 Some minor versions of AppleClang 9 appear not to fail the test. It's such a mess that the only sane thing to do is to mark the test as UNSUPPORTED. llvm-svn: 366606
* Revert "[libc++] Integrate the PSTL into libc++"Louis Dionne2019-07-1914-59/+0
| | | | | | | This reverts r366593, which caused unforeseen breakage on the build bots. I'm reverting until the problems have been figured out and fixed. llvm-svn: 366603
* [libc++] Allow passing additional CMake arguments in macOS trunk CI scriptLouis Dionne2019-07-191-1/+9
| | | | llvm-svn: 366601
* [libc++] Use _EnableIf instead of std::enable_if in deduction guides for map ↵Louis Dionne2019-07-192-24/+24
| | | | | | and set llvm-svn: 366594
* [libc++] Integrate the PSTL into libc++Louis Dionne2019-07-1914-0/+59
| | | | | | | | | | | | | | | | | | | | | | Summary: This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when configuring libc++ in CMake. When that option is enabled, libc++ will assume that the PSTL can be found somewhere on the CMake module path, and it will provide the C++17 parallel algorithms based on the PSTL (that is assumed to be available). The commit also adds support for running the PSTL tests as part of the libc++ test suite. Reviewers: rodgert, EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF Tags: #libc Differential Revision: https://reviews.llvm.org/D60480 llvm-svn: 366593
* [libc++] Add missing %link_flags to .sh.cpp testLouis Dionne2019-07-191-1/+1
| | | | | | | Without the link flags, the test always fails on Linux. For some reason, however, it works on Darwin -- which is why it wasn't caught at first. llvm-svn: 366579
* [libc++] Fix link error with _LIBCPP_HIDE_FROM_ABI_PER_TU and std::stringLouis Dionne2019-07-192-10/+21
| | | | | | | | | | | | | | | | | | | | | Summary: This is effectively a revert of r344616, which was a partial fix for PR38964 (compilation of <string> with GCC in C++03 mode). However, that configuration is explicitly not supported anymore and that partial fix breaks compilation with Clang when per-TU insulation is provided. PR42676 rdar://52899715 Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D64941 llvm-svn: 366567
* [libc++] Add C++17 deduction guides for std::functionLouis Dionne2019-07-184-0/+337
| | | | | | | | | | | | Summary: http://llvm.org/PR39606 Reviewers: Quuxplusone Subscribers: christof, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D54410 llvm-svn: 366484
* Bump the trunk version to 10.0.0svnHans Wennborg2019-07-185-12/+12
| | | | | | and clear the release notes. llvm-svn: 366427
* [libc++] XFAIL a test that does not behave properly on older ClangLouis Dionne2019-07-171-0/+4
| | | | | | rdar://53015486 llvm-svn: 366359
* [libcxx] Rejigger test for destroying delete feature-test macrosLouis Dionne2019-07-161-4/+13
| | | | | | | | | In r361572, we introduced library support for C++20 destroying delete and decided to only define the library feature-test macro when the compiler supports the underlying language feature. This patch reworks the tests to mirror that. llvm-svn: 366263
* [libc++] Add missing UNSUPPORTED for CTAD testsLouis Dionne2019-07-162-0/+2
| | | | | | | The tests for unordered_set and unordered_multiset were missing UNSUPPORTED markup for Apple Clang 9.1, which is still being used on some CI bots. llvm-svn: 366259
* Add contains method to associative containers. This patch implements ↵Zoe Carver2019-07-169-6/+263
| | | | | | P0458R2, adding contains to map, multimap, unordered_map, unordered_multimap, set, multiset, unordered_set, and unordered_multiset. llvm-svn: 366170
* [libc++] Implement P0433: deduction guides for <unordered_map>Louis Dionne2019-07-158-7/+1106
| | | | | | | | Thanks to Arthur O'Dwyer for the patch. Differential Revision: https://reviews.llvm.org/D58590 llvm-svn: 366124
* Constrain workaround to avoid affecting other buildbotsEric Fiselier2019-07-151-2/+4
| | | | llvm-svn: 366122
* Improve compile time of variant.Eric Fiselier2019-07-142-31/+154
| | | | | | | | | | In particular, improve the compile time of the overload set builder that variant uses to determine which alternative to construct. Instead of having the __overload type construct itself recursively, this patch uses a flat construction for the overload set. llvm-svn: 366033
* Add test for variant construction with duplicate types.Eric Fiselier2019-07-141-0/+12
| | | | llvm-svn: 366032
* Cleanup whitespace in <variant>. NFC.Eric Fiselier2019-07-141-11/+7
| | | | llvm-svn: 366026
* Harden variant test added in r366022Eric Fiselier2019-07-141-3/+3
| | | | | | | The test was brittle since it only went boom for one specific type, when really it should go boom for all of them. llvm-svn: 366025
* Avoid eager template instantiation caused by the variant narrowing checks.Eric Fiselier2019-07-142-9/+41
| | | | | | | | | | | | | | | | | | The standard disallows narrowing conversions when constructing a variant. This is checked by attempting to perform braced initialization of the destination type from the argument type. However, braced initialization can force the compiler (mostly clang) to eagerly instantiate the constructors of the destintation type -- which can lead to errors in a non-immediate context. However, as variant is currently specified, the narrowing checks only observably apply when the destination type is arithmetic. Meaning we can skip the check for class types. Hense avoiding the hard errors. In order to cause fewer build breakages, this patch avoids the narrowing check except when the destination type is arithmetic. llvm-svn: 366022
* Fix non-conformance it `std::tuple`.Eric Fiselier2019-07-122-20/+47
| | | | | | | | | | | | | | Previously we implemented all one trillion tuple-like constructors using a single generic overload. This worked fairly well, except that it differed in behavior from the standard version because it didn't consider both T&& and T const&. This was observable for certain types. This patch addresses that issue by splitting the generic constructor in two. We now provide both T&& and T const& versions of the tuple-like constructors (sort of). llvm-svn: 365973
* Add option to disable variant narrowing conversion changes.Eric Fiselier2019-07-128-93/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The paper P0608R3 - "A sane variant converting constructor" disallows narrowing conversions in variant. It was meant to address this surprising problem: std::variant<std::string, bool> v = "abc"; assert(v.index() == 1); // constructs a bool. However, it also disables every potentially narrowing conversion. For example: variant<unsigned> v = 0; // ill-formed variant<string, double> v2 = 42; // ill-formed (int -> double narrows) These latter changes break code. A lot of code. Within Google it broke on the order of a hundred thousand target with thousands of root causes responsible for the breakages. Of the breakages related to the narrowing restrictions, none of them exposed outstanding bugs. However, the breakages caused by boolean conversions (~13 root causes), all but one of them were bugs. For this reasons, I am adding a flag to disable the narrowing conversion changes but not the boolean conversions one. One purpose of this flag is to allow users to opt-out of breaking changes in variant until the offending code can be cleaned up. For non-trivial variant usages the amount of cleanup may be significant. This flag is also required to support automated tooling, such as clang-tidy, that can automatically fix code broken by this change. In order for clang-tidy to know the correct alternative to construct, it must know what alternative was being constructed previously, which means running it over the old version of std::variant. Because this change breaks so much code, I will be implementing the aforementioned clang-tidy check in the very near future. Additionally I'm plan present this new information to the committee so they can re-consider if this is a breaking change we want to make. I think libc++ should very seriously consider pulling this change before the 9.0 release branch is cut. But that's a separate discussion that I will start on the lists. For now this is the minimal first step. llvm-svn: 365960
* [libc++] Add XFAILs for CTAD tests on older compilersLouis Dionne2019-07-122-0/+2
| | | | llvm-svn: 365923
* Mark destroying delete test as UNSUPPORTED with clang 7Eric Fiselier2019-07-121-1/+1
| | | | llvm-svn: 365856
* Tolerate import errors in "not.py" implementationEric Fiselier2019-07-121-4/+12
| | | | llvm-svn: 365855
* Reorganize the 'bit' header to make most of the facilities available for ↵Marshall Clow2019-07-125-117/+263
| | | | | | internal use pre-C++20. NFC for external users llvm-svn: 365854
* Add another buildbot username to the workaround listEric Fiselier2019-07-121-1/+1
| | | | llvm-svn: 365848
* Attempt to override broken buildbot config for libc++abi.Eric Fiselier2019-07-121-0/+8
| | | | | | | | | | | The buildbots were changed to pass -DLIBCXX_CXX_ABI=libcxxabi, but they don't provide an include path for the library, so cxxabi.h is never found while building libc++. This is a temporary change until the buildbots are updated or until D63883 lands in a form that unbreaks the bots llvm-svn: 365847
* Fix memory leak in set and map.Eric Fiselier2019-07-113-128/+129
| | | | | | | | When assigning an initializer list into set/map, libc++ would leak memory if the initializer list contained equivalent keys because we failed to check if the insertion was successful. llvm-svn: 365840
* [libc++] Implement deduction guides for <unordered_set>Louis Dionne2019-07-115-6/+702
| | | | | | | Thanks to Arthur O'Dwyer for the patch. Differential Revision: https://reviews.llvm.org/D58617 llvm-svn: 365788
* build: use multiple `install` rather than building up a listSaleem Abdulrasool2019-07-091-12/+20
| | | | | | | | Rather than building up a list to iterate over later, just create multiple install commands based on the configuration. This makes it easier to see what is getting installed and allows for the install handling to be centralised. NFC llvm-svn: 365562
* Revert "[libc++] Take 2: Do not cleverly link against libc++abi just because ↵Vitaly Buka2019-07-082-1/+14
| | | | | | | | | | | | | | it happens to be there" r365326 still breaks bots: http://lab.llvm.org:8011/builders/netbsd-amd64/builds/20712/steps/ninja%20build%20local/logs/stdio http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/39477/steps/test%20tsan%20in%20debug%20compiler-rt%20build/logs/stdio And probably others This reverts commit 945b9ec0693390ef35fe8c6b774495312246b8b6. llvm-svn: 365359
* [libc++] Take 2: Do not cleverly link against libc++abi just because it ↵Louis Dionne2019-07-082-14/+1
| | | | | | | | | | | | | | | | | | | | | happens to be there Summary: Otherwise, when libcxxabi is not an enabled project in the monorepo, we get a link error because we try to link against non-existent cxxabi_shared. More generally, we shouldn't change the behavior of the build based on implicit things like whether a file happens to be at a specific path or not. This is a re-application of r365222 that had been reverted in r365233 because it broke the build bots. However, the build bots now specify explicitly what ABI library they want to use (libc++abi), so this commit should now be OK to merge. Differential Revision: https://reviews.llvm.org/D63883 llvm-svn: 365326
* Make forward_list::remove/remove_if/unique all return void before C++20; ↵Marshall Clow2019-07-086-82/+152
| | | | | | undoes that bit of D58332. Thanks to Mikhail Maltsev for pointing this out llvm-svn: 365290
* Make ~mutex and ~condition_variable trivial on Windows.Eric Fiselier2019-07-075-19/+66
| | | | | | | | | The implementations of __libcpp_mutex_destroy and __libcpp_condvar_destroy are already NOPs, so this optimization is safe to perform. See r365273 and PR27658 for more information. llvm-svn: 365281
OpenPOWER on IntegriCloud