| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[libc++] Fix the behavior of throwing operator new under -fno-exceptions (#69498) In D144319, Clang tried to land a change that would cause some functions that are not supposed to return nullptr to optimize better. As reported in https://reviews.llvm.org/D144319#4203982, libc++ started seeing failures in its CI shortly after this change was landed. As explained in D146379, the reason for these failures is that libc++'s throwing operator new can in fact return nullptr when compiled with exceptions disabled. However, this contradicts the Standard, which clearly says that the throwing version of operator new(size_t) should never return nullptr. This is actually a long standing issue. I've previously seen a case where LTO would optimize incorrectly based on the assumption that operator new doesn't return nullptr, an assumption that was violated in that case because libc++.dylib was compiled with -fno-exceptions. Unfortunately, fixing this is kind of tricky. The Standard has a few requirements for the allocation functions, some of which are impossible to satisfy under -fno-exceptions: 1. operator new(size_t) must never return nullptr 2. operator new(size_t, nothrow_t) must call the throwing version and return nullptr on failure to allocate 3. We can't throw exceptions when compiled with -fno-exceptions In the case where exceptions are enabled, things work nicely. new(size_t) throws and new(size_t, nothrow_t) uses a try-catch to return nullptr. However, when compiling the library with -fno-exceptions, we can't throw an exception from new(size_t), and we can't catch anything from new(size_t, nothrow_t). The only thing we can do from new(size_t) is actually abort the program, which does not make it possible for new(size_t, nothrow_t) to catch something and return nullptr. This patch makes the following changes: 1. When compiled with -fno-exceptions, the throwing version of operator new will now abort on failure instead of returning nullptr on failure. This resolves the issue that the compiler could mis-compile based on the assumption that nullptr is never returned. This constitutes an API and ABI breaking change for folks compiling the library with -fno-exceptions (which is not the general public, who merely uses libc++ headers but use a shared library that has already been compiled). This should mostly impact vendors and other folks who compile libc++.dylib themselves. 2. When the library is compiled with -fexceptions, the nothrow version of operator new has no change. When the library is compiled with -fno-exceptions, the nothrow version of operator new will now check whether the throwing version of operator new has been overridden. If it has not been overridden, then it will use an implementation equivalent to that of the throwing operator new, except it will return nullptr on failure to allocate (instead of terminating). However, if the throwing operator new has been overridden, it is now an error NOT to also override the nothrow operator new. Indeed, there is no way for us to implement a valid nothrow operator new without knowing the exact implementation of the throwing version. In summary, this change will impact people who fall into the following intersection of conditions: - They use the libc++ shared/static library built with -fno-exceptions - They do not override operator new(..., std::nothrow_t) - They override operator new(...) (the throwing version) - They use operator new(..., std::nothrow_t) We believe this represents a small number of people. Fixes #60129 rdar://103958777 Differential Revision: https://reviews.llvm.org/D150610 | 2 年前 | |
[libcxx][test] compiler options are non-portable ... it's easier to suppress warnings internally, where we can detect the compiler. * Rename TEST_COMPILER_C1XX to TEST_COMPILER_MSVC * Rename all TEST_WORKAROUND_C1XX_<meow> to TEST_WORKAROUND_MSVC_<meow> Differential Revision: https://reviews.llvm.org/D117422 | 4 年前 | |
[libc++][NFC] Consistently use newline between license and include guard | 3 年前 | |
[libc++] Counter<T>'s assignment operator shouldn't ++gConstructed This has been here since d5f461ca03e30, but assigning into an existing Counter object definitely doesn't create a new object. This causes the count to "leak" higher and higher, inside algorithms based on swapping. | 3 年前 | |
[libc++] NFC: Normalize #endif // comment indentation | 5 年前 | |
[libc++] Fix std::move algorithm with trivial move-only types As reported in https://reviews.llvm.org/D151953#4472195, the std::move algorithm (and various other functions that relied on it) stopped working after starting to use __constexpr_memmove in its implementation. This patch fixes the underlying issue in __constexpr_memmove and adds tests for various related algorithms and functions that were not exercising trivial move-only types. Differential Revision: https://reviews.llvm.org/D154613 | 3 年前 | |
[libc++][test] Fix MaybePOCCAAllocator to finally meet the allocator requirements (#74960) Found while running libc++'s test suite with MSVC's STL. After @CaseyCarter's [LLVM-D118279](https://reviews.llvm.org/D118279) https://github.com/llvm/llvm-project/commit/c5ba46ea1804dfefb22e6d2bb65ff1636d2cc8cd "\[libcxx\]\[test\] MaybePOCCAAllocator should meet the *Cpp17Allocator* requirements" followed by @philnik777's [LLVM-D68365](https://reviews.llvm.org/D68365) https://github.com/llvm/llvm-project/commit/98d3d5b5da66e3cf7807c23a0294280bb796466b "\[libc++\] Implement [P1004R2](https://wg21.link/P1004R2) (constexpr std::vector)", one more change is necessary. MSVC's constexpr vector implementation noticed this because we always rebind allocators. | 2 年前 | |
[libc++][ranges][NFC] Templatize some of the types in almost_satisfies_types.h | 3 年前 | |
[libc++][NFC] Consistently use newline between license and include guard | 3 年前 | |
[libc++] Granularize <iterator> includes Reviewed By: ldionne, #libc Spies: libcxx-commits, wenlei Differential Revision: https://reviews.llvm.org/D127445 | 4 年前 | |
[libc++][test] Add license headers to test/support/archetypes.* Differential Revision: https://reviews.llvm.org/D68947 llvm-svn: 374797 | 6 年前 | |
[ASan][libc++] Turn on ASan annotations for short strings (#79536) This pull request is the third iteration aiming to integrate short string annotations. This commit includes: - Enabling basic_string annotations for short strings. - Setting a value of __trivially_relocatable in std::basic_string to false_type when compiling with ASan (nothing changes when compiling without ASan). Short string annotations make std::basic_string to not be trivially relocatable, because memory has to be unpoisoned. - Adding a _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS modifier to two functions. - Creating a macro _LIBCPP_ASAN_VOLATILE_WRAPPER to prevent problematic stack optimizations (the macro modifies code behavior only when compiling with ASan). Previously we had issues with compiler optimization, which we understand thanks to @vitalybuka. This commit also addresses smaller changes in short string, since previous upstream attempts. Problematic optimization was loading two values in code similar to: __is_long() ? __get_long_size() : __get_short_size(); We aim to resolve it with the volatile wrapper. This commit is built on top of two previous attempts which descriptions are below. Additionally, in the meantime, annotations were updated (but it shouldn't have any impact on anything): - https://github.com/llvm/llvm-project/pull/79292 --- Previous PR: https://github.com/llvm/llvm-project/pull/79049 Reverted: https://github.com/llvm/llvm-project/commit/a16f81f5e3313e88f96de35e5edfe8bee463d308 Previous description: Originally merged here: https://github.com/llvm/llvm-project/pull/75882 Reverted here: https://github.com/llvm/llvm-project/pull/78627 Reverted due to failing buildbots. The problem was not caused by the annotations code, but by code in the UniqueFunctionBase class and in the JSON.h file. That code caused the program to write to memory that was already being used by string objects, which resulted in an ASan error. Fixes are implemented in: - https://github.com/llvm/llvm-project/pull/79065 - https://github.com/llvm/llvm-project/pull/79066 Problematic code from UniqueFunctionBase for example: cpp // In debug builds, we also scribble across the rest of the storage. memset(RHS.getInlineStorage(), 0xAD, InlineStorageSize); --- Original description: This commit turns on ASan annotations in std::basic_string for short stings (SSO case). Originally suggested here: https://reviews.llvm.org/D147680 String annotations added here: https://github.com/llvm/llvm-project/pull/72677 Requires to pass CI without fails: - https://github.com/llvm/llvm-project/pull/75845 - https://github.com/llvm/llvm-project/pull/75858 Annotating std::basic_string with default allocator is implemented in https://github.com/llvm/llvm-project/pull/72677 but annotations for short strings (SSO - Short String Optimization) are turned off there. This commit turns them on. This also removes _LIBCPP_SHORT_STRING_ANNOTATIONS_ALLOWED, because we do not plan to support turning on and off short string annotations. Support in ASan API exists since https://github.com/llvm/llvm-project/commit/dd1b7b797a116eed588fd752fbe61d34deeb24e4. You can turn off annotations for a specific allocator based on changes from https://github.com/llvm/llvm-project/commit/2fa1bec7a20bb23f2e6620085adb257dafaa3be0. This PR is a part of a series of patches extending AddressSanitizer C++ container overflow detection capabilities by adding annotations, similar to those existing in std::vector and std::deque collections. These enhancements empower ASan to effectively detect instances where the instrumented program attempts to access memory within a collection's internal allocation that remains unused. This includes cases where access occurs before or after the stored elements in std::deque, or between the std::basic_string's size (including the null terminator) and capacity bounds. The introduction of these annotations was spurred by a real-world software bug discovered by Trail of Bits, involving an out-of-bounds memory access during the comparison of two strings using the std::equals function. This function was taking iterators (iter1_begin, iter1_end, iter2_begin) to perform the comparison, using a custom comparison function. When the iter1 object exceeded the length of iter2, an out-of-bounds read could occur on the iter2 object. Container sanitization, upon enabling these annotations, would effectively identify and flag this potential vulnerability. If you have any questions, please email: - advenam.tacet@trailofbits.com - disconnect3d@trailofbits.com | 2 年前 | |
[libc++] Add CI job for testing macOS C++03 (#75355) It's not that I have much love for C++03, but we should ensure that it works. Some recent changes broke this configuration because slightly older Clang versions don't support attribute syntax in C++03 mode. | 2 年前 | |
[libc++] Fix bug in atomic_ref's calculation of lock_free-ness (#99570) The builtin __atomic_always_lock_free takes into account the type of the pointer provided as the second argument. Because we were passing void*, rather than T*, the calculation failed. This meant that atomic_ref<T>::is_always_lock_free was only true for char & bool. This bug exists elsewhere in the atomic library (when using GCC, we fail to pass a pointer at all, and we fail to correctly align the atomic like _Atomic would). This change also attempts to start sorting out testing difficulties with this function that caused the bug to exist by using the __GCC_ATOMIC_(CHAR|SHORT|INT|LONG|LLONG|POINTER)_IS_LOCK_FREE predefined macros to establish an expected value for is_always_lock_free and is_lock_free for the respective types, as well as types with matching sizes and compatible alignment values. Using these compiler pre-defines we can actually validate that certain types, like char and int, are actually always lock free like they are on every platform in the wild. Note that this patch was actually authored by Eric Fiselier but I picked up the patch and GitHub won't let me set Eric as the primary author. Co-authored-by: Eric Fiselier <eric@efcs.ca> (cherry picked from commit cc1dfb37aa84d1524243b83fadb8ff0f821e03e9) | 2 年前 | |
[libc++][test] Cleanup typos and unnecessary semicolons (#73435) I've structured this into a series of commits for even easier reviewing, if that helps. I could easily split this up into separate PRs if desired, but as this is low-risk with simple edits, I thought one PR would be easiest. * Drop unnecessary semicolons after function definitions. * Cleanup comment typos. * Cleanup static_assert typos. * Cleanup test code typos. + There should be no functional changes, assuming I've changed all occurrences. * ~~Fix massive test code typos.~~ + This was a real problem, but needed more surgery. I reverted those changes here, and @philnik777 is fixing this properly with #73444. * clang-formatting as requested by the CI. | 2 年前 | |
[libc++] Suppress -Wctad-maybe-unsupported on types w/o deduction guides There are a handful of standard library types that are intended to support CTAD but don't need any explicit deduction guides to do so. This patch adds a dummy deduction guide to those types to suppress -Wctad-maybe-unsupported (which gets emitted in user code). This is a re-application of the original patch by Eric Fiselier in fcd549a7d828 which had been reverted due to reasons lost at this point. I also added the macro to a few more types. Reviving this patch was prompted by the discussion on https://llvm.org/D133425. Differential Revision: https://reviews.llvm.org/D133535 | 3 年前 | |
[libc++] Move __errc to __system_error/errc.h This file was added before we started granularizing the headers, but is essentially just a granularized header. This moves the header to the correct place. Reviewed By: #libc, EricWF Spies: libcxx-commits, arichardson, mikhail.ramalho Differential Revision: https://reviews.llvm.org/D146395 | 3 年前 | |
[libc++] Test suite portability improvements (#98527) This patch contains a number of small portability improvements for the test suite, making it easier to run the test suite with other standard library implementations. - Guard checks for _LIBCPP_HARDENING_MODE to avoid -Wundef - Avoid defining _LIBCPP_HARDENING_MODE even when no hardening mode is specified -- we should use the default mode of the library in that case. - Add missing includes and qualify a few function calls. - Avoid opening namespace std to forward declare stdlib containers. The test suite should represent user code, and user code isn't allowed to do that. | 2 年前 | |
Update atomic feature macros, synopsis, signatures to match C++20. Improve test coverage for non-lock-free atomics. | 5 年前 | |
[libc++][NFC] Consistently use newline between license and include guard | 3 年前 | |
[libc++][test] Fix MSVC warnings with static_casts (#74962) Found while running libc++'s tests with MSVC's STL. * libcxx/test/std/algorithms/alg.modifying.operations/alg.unique/ranges_unique_copy.pass.cpp + Fix MSVC "warning C4389: '==': signed/unsigned mismatch". + This was x86-specific for me. The LHS is int and the RHS is size_t. We know the array's size, so static_cast<int> is certainly safe, and this matches the following numberOfProj comparisons. * libcxx/test/std/containers/sequences/insert_range_sequence_containers.h + Fix MSVC "warning C4267: 'argument': conversion from 'size_t' to 'const int', possible loss of data". + test_case.index is size_t: https://github.com/llvm/llvm-project/blob/b85f1f9b182234ba366d78ae2174a149e44d08c1/libcxx/test/std/containers/insert_range_helpers.h#L65-L68 + But the container's difference_type is int: https://github.com/llvm/llvm-project/blob/b85f1f9b182234ba366d78ae2174a149e44d08c1/libcxx/test/support/test_allocator.h#L65-L76 + I introduced an alias D to make the long line more readable. * libcxx/test/std/containers/unord/unord.map/eq.different_hash.pass.cpp * libcxx/test/std/containers/unord/unord.multimap/eq.different_hash.pass.cpp * libcxx/test/std/containers/unord/unord.multiset/eq.different_hash.pass.cpp * libcxx/test/std/containers/unord/unord.set/eq.different_hash.pass.cpp + Fix MSVC "warning C6297: Arithmetic overflow. Results might not be an expected value." + This warning is almost annoying enough to outright disable, but we use similar static_casts to deal with sign/truncation warnings elsewhere, because there's some value in ensuring that product code is clean with respect to these warnings. If there were many more occurrences, then disabling the warning would be appropriate. + Cleanup: Change 2 inconsistently unqualified occurrences of size_t to std::size_t. * libcxx/test/std/containers/views/mdspan/layout_stride/index_operator.pass.cpp + Fix MSVC "warning C4244: 'initializing': conversion from '__int64' to 'size_t', possible loss of data". + This was x86-specific for me. The args are indeed int64_t, and we're storing the result in size_t, so we should cast. * libcxx/test/std/ranges/range.utility/range.utility.conv/container.h + Fix MSVC "warning C4244: 'initializing': conversion from 'ptrdiff_t' to 'int', possible loss of data". + Fix MSVC "warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data". + We're initializing int size_, so we should explicitly cast from pointer subtraction and std::ranges::size. * libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_for_overwrite.pass.cpp * libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared_for_overwrite.pass.cpp * libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique_for_overwrite.default_init.pass.cpp + Fix MSVC "warning C4309: 'initializing': truncation of constant value". + MSVC emits this warning because 0xDE is outside the range of char (signed by default in our implementation). * libcxx/test/support/concat_macros.h + Fix MSVC "warning C4244: 'argument': conversion from 'char16_t' to 'const char', possible loss of data". + Fix MSVC "warning C4244: 'argument': conversion from 'unsigned int' to 'const char', possible loss of data". + This code was very recently introduced by @mordante in #73395. | 2 年前 | |
[libc++][test] Fixes constexpr char_traits. (#90981) The issue in nasty_char_traits was discovered by @StephanTLavavej who provided the solution they use in MSVC STL. This solution is based on that example. The same issue affects the constexpr_char_traits which was discovered in https://github.com/llvm/llvm-project/pull/88389. This uses the same fix. Fixes: https://github.com/llvm/llvm-project/issues/74221 | 2 年前 | |
[libc++] Remove dependence on <ciso646> (#73271) C++23 removed <ciso646> from the standard library. The header is used in a few places in order to pull in implementation-specific and feature test macros. The new way of doing that is <version>, which should be supported by all supported implementations. This change replaces all those uses of <ciso646> with <version>. | 2 年前 | |
[libc++] Test suite portability improvements (#98527) This patch contains a number of small portability improvements for the test suite, making it easier to run the test suite with other standard library implementations. - Guard checks for _LIBCPP_HARDENING_MODE to avoid -Wundef - Avoid defining _LIBCPP_HARDENING_MODE even when no hardening mode is specified -- we should use the default mode of the library in that case. - Add missing includes and qualify a few function calls. - Avoid opening namespace std to forward declare stdlib containers. The test suite should represent user code, and user code isn't allowed to do that. | 2 年前 | |
[libc++] Qualifies size_t. This has been done using the following command find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)size_t)|\1std::\2|' \{} \; And manually removed some false positives in std/depr/depr.c.headers. The std module doesn't export ::size_t, this is a preparation for that module. Reviewed By: ldionne, #libc, EricWF, philnik Differential Revision: https://reviews.llvm.org/D146088 | 3 年前 | |
[libc++][test] Cleanup typos and unnecessary semicolons (#73435) I've structured this into a series of commits for even easier reviewing, if that helps. I could easily split this up into separate PRs if desired, but as this is low-risk with simple edits, I thought one PR would be easiest. * Drop unnecessary semicolons after function definitions. * Cleanup comment typos. * Cleanup static_assert typos. * Cleanup test code typos. + There should be no functional changes, assuming I've changed all occurrences. * ~~Fix massive test code typos.~~ + This was a real problem, but needed more surgery. I reverted those changes here, and @philnik777 is fixing this properly with #73444. * clang-formatting as requested by the CI. | 2 年前 | |
[libc++] Handle 0 size case for testing support operator new (#93834) The return of malloc is implementation defined when the requested size is 0. On platforms (such as AIX) that return a null pointer for 0 size, operator new will throw a bad_alloc exception. operator new should return a non null pointer for 0 size instead. | 2 年前 | |
[libc++][test] Add '-Wdeprecated-copy', '-Wdeprecated-copy-dtor' warnings to the test suite This is a follow up to https://reviews.llvm.org/D144694. Fixes https://github.com/llvm/llvm-project/issues/60977. Differential Revision: https://reviews.llvm.org/D144775 | 2 年前 | |
[libc++] Fix minor formatting error in test/support/counting_projection.h (#72480) Causing CI/CD to fail. | 2 年前 | |
[libc++] Remove <queue> and <stack> includes from <format> (#85520) This reduces the include time of <format> from 691ms to 556ms. | 2 年前 | |
[libc++][test] Add '-Wdeprecated-copy', '-Wdeprecated-copy-dtor' warnings to the test suite This is a follow up to https://reviews.llvm.org/D144694. Fixes https://github.com/llvm/llvm-project/issues/60977. Differential Revision: https://reviews.llvm.org/D144775 | 2 年前 | |
[libc++] Make some testing utilities constexpr This will be needed in order to test constexpr std::vector. | 5 年前 | |
[libc++][NFC] Consistently use newline between license and include guard | 3 年前 | |
[libc++] Test suite portability improvements (#98527) This patch contains a number of small portability improvements for the test suite, making it easier to run the test suite with other standard library implementations. - Guard checks for _LIBCPP_HARDENING_MODE to avoid -Wundef - Avoid defining _LIBCPP_HARDENING_MODE even when no hardening mode is specified -- we should use the default mode of the library in that case. - Add missing includes and qualify a few function calls. - Avoid opening namespace std to forward declare stdlib containers. The test suite should represent user code, and user code isn't allowed to do that. | 2 年前 | |
[libc++] Use _Complex for multiplication and division of complex floating point types (#83575) This significantly simplifies the implementation and improves the codegen. The only downside is that the accuracy can be marginally worse, but that is up to the compiler to decide with this change, which means it can be controlled by compiler flags. Differential Revision: https://reviews.llvm.org/D155312 | 2 年前 | |
[libc++][format] Fix a missing include in <format> tests. (#71252) | 2 年前 | |
[libcxx] Fixed a number of typos I went over the output of the following mess of a command: (ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less) and proceeded to spend a few days looking at it to find probable typos and fixed a few hundred of them in all of the llvm project (note, the ones I found are not anywhere near all of them, but it seems like a good start). Reviewed By: #libc, philnik Spies: philnik, libcxx-commits, mgorny, arichardson Differential Revision: https://reviews.llvm.org/D130905 | 3 年前 | |
[libc++][math] Fix undue overflowing of std::hypot(x,y,z) (#100820) This is in relation to mr #93350. It was merged to main, but reverted because of failing sanitizer builds on PowerPC. The fix includes replacing the hard-coded threshold constants (e.g. __overflow_threshold) for different floating-point sizes by a general computation using std::ldexp. Thus, it should now work for all architectures. This has the drawback of not being constexpr anymore as std::ldexp is not implemented as constexpr (even though the standard mandates it for C++23). Closes #92782 (cherry picked from commit 72825fde03aab3ce9eba2635b872144d1fb6b6b2) | 1 年前 | |
Update more file headers across all of the LLVM projects in the monorepo to reflect the new license. These used slightly different spellings that defeated my regular expressions. 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: 351648 | 7 年前 | |
[libc++][NFC] Consistently use newline between license and include guard | 3 年前 | |
[libc++][NFC] Fix unparenthesized comma expression in mem-initializer (#89605) #84050 resolves class member access expressions naming members of the current instantiation prior to instantiation. In testing, it has revealed a mem-initializer in the move constructor of invocable_with_telemetry that uses an unparenthesized comma expression to initialize a non-static data member of pointer type. This patch fixes it. | 2 年前 | |
[libc++] [P0919] Some belated review on D87171. - Simplify the structure of the new tests. - Test const containers as well as non-const containers, since it's easy to do so. - Remove redundant enable-iffing of helper structs' member functions. (They're not instantiated unless they're called, and who would call them?) - Fix indentation and use more consistent SFINAE method in <unordered_map>. - Add _LIBCPP_INLINE_VISIBILITY on some swap functions. Differential Revision: https://reviews.llvm.org/D109011 | 4 年前 | |
[libc++][test] Cleanup typos and unnecessary semicolons (#73435) I've structured this into a series of commits for even easier reviewing, if that helps. I could easily split this up into separate PRs if desired, but as this is low-risk with simple edits, I thought one PR would be easiest. * Drop unnecessary semicolons after function definitions. * Cleanup comment typos. * Cleanup static_assert typos. * Cleanup test code typos. + There should be no functional changes, assuming I've changed all occurrences. * ~~Fix massive test code typos.~~ + This was a real problem, but needed more surgery. I reverted those changes here, and @philnik777 is fixing this properly with #73444. * clang-formatting as requested by the CI. | 2 年前 | |
[libc++][NFC] Consistently use newline between license and include guard | 3 年前 | |
[libc++] [P0935] [C++20] Eradicating unnecessarily explicit default constructors from the standard library. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0935r0.html Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D91292 | 5 年前 | |
[libc++] Qualifies size_t. This has been done using the following command find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)size_t)|\1std::\2|' \{} \; And manually removed some false positives in std/depr/depr.c.headers. The std module doesn't export ::size_t, this is a preparation for that module. Reviewed By: ldionne, #libc, EricWF, philnik Differential Revision: https://reviews.llvm.org/D146088 | 3 年前 | |
[libc++] Introduce make_test_jthread for jthread tests (#68837) This patch introduces the support::make_test_jthread utility which is basically the same as support::make_test_thread but for std::jthread. It allows vendors to maintain a downstream way to create threads for use within the test suite, which is especially useful for embedded platforms. | 2 年前 | |
[libcxx] adds ranges::fold_left_with_iter and ranges::fold_left (#75259) Notable things in this commit: * refactors __indirect_binary_left_foldable, making it slightly different (but equivalent) to _indirect-binary-left-foldable_, which improves readability (a [patch to the Working Paper][patch] was made) * omits __cpo namespace, since it is not required for implementing niebloids (a cleanup should happen in 2024) * puts tests ensuring invocable robustness and dangling correctness inside the correctness testing to ensure that the algorithms' results are still correct [patch]: https://github.com/cplusplus/draft/pull/6734 | 2 年前 | |
[libc++][test] Don't use __libcpp_is_constant_evaluated in tests (#72226) | 2 年前 | |
[libc++] [test] Fix portability issues for MSVC (#93259) * Guard std::__make_from_tuple_impl tests with #ifdef _LIBCPP_VERSION and LIBCPP_STATIC_ASSERT. * Change _LIBCPP_CONSTEXPR_SINCE_CXX20 to TEST_CONSTEXPR_CXX20. + Other functions in variant.swap/swap.pass.cpp were already using the proper test macro. * Mark what as [[maybe_unused]] when used by TEST_LIBCPP_REQUIRE. + This updates one occurrence in libcxx/test/libcxx for consistency. * Windows _putenv_s() takes 2 arguments, not 3. + See MSVC documentation: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-s-wputenv-s?view=msvc-170 + POSIX setenv() takes int overwrite, but Windows _putenv_s() always overwrites. * Avoid non-Standard zero-length arrays. + Followup to #74183 and #79792. * Add operator++() to unsized_it. + The Standard requires this due to [N4981][] [move.iter.requirements]/1 "The template parameter Iterator shall either meet the *Cpp17InputIterator* requirements ([input.iterators]) or model input_iterator ([iterator.concept.input])." + MSVC's STL requires this because it has a strengthened exception specification in move_iterator that inspects the underlying iterator's increment operator. * uniform_int_distribution forbids int8_t/uint8_t. + See [N4981][] [rand.req.genl]/1.5. MSVC's STL enforces this. + Note that when changing the distribution's IntType, we need to be careful to preserve the original value range of [0, max_input]. * fstreams are constructible from const fs::path::value_type* on wide systems. + See [ifstream.cons], [ofstream.cons], [fstream.cons]. * In msvc_stdlib_force_include.h, map _HAS_CXX23 to TEST_STD_VER 23 instead of 99. + On 2023-05-23, https://github.com/llvm/llvm-project/commit/71400505ca048507e827013eb1ea0bc863525cab started recognizing 23 as a distinct value. * Fix test name typo: destory_elements.pass.cpp => destroy_elements.pass.cpp [N4981]: https://wg21.link/N4981 | 2 年前 | |
[libc++] Refactor<__type_traits/is_swappable.h> (#86822) This changes the is_swappable implementation to use variable templates first and basing the class templates on that. This avoids instantiating them when the _v versions are used, which are generally less resource intensive. | 2 年前 | |
[libc++][test] Fixes constexpr char_traits. (#90981) The issue in nasty_char_traits was discovered by @StephanTLavavej who provided the solution they use in MSVC STL. This solution is based on that example. The same issue affects the constexpr_char_traits which was discovered in https://github.com/llvm/llvm-project/pull/88389. This uses the same fix. Fixes: https://github.com/llvm/llvm-project/issues/74221 | 2 年前 | |
[libc++] Qualifies size_t. This has been done using the following command find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)size_t)|\1std::\2|' \{} \; And manually removed some false positives in std/depr/depr.c.headers. The std module doesn't export ::size_t, this is a preparation for that module. Reviewed By: ldionne, #libc, EricWF, philnik Differential Revision: https://reviews.llvm.org/D146088 | 3 年前 | |
[libc++] NFC: Normalize #endif // comment indentation | 5 年前 | |
[libc++] Qualifies size_t. This has been done using the following command find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)size_t)|\1std::\2|' \{} \; And manually removed some false positives in std/depr/depr.c.headers. The std module doesn't export ::size_t, this is a preparation for that module. Reviewed By: ldionne, #libc, EricWF, philnik Differential Revision: https://reviews.llvm.org/D146088 | 3 年前 | |
[libc++][NFC] Consistently use newline between license and include guard | 3 年前 | |
[libc++] Refactor<__type_traits/is_swappable.h> (#86822) This changes the is_swappable implementation to use variable templates first and basing the class templates on that. This avoids instantiating them when the _v versions are used, which are generally less resource intensive. | 2 年前 | |
[libc++] Remove unnecessary usage of <iostream> in the test suite Tests should strive to be as minimal as possible, since it makes them relevant on platforms where <iostream> does not work. | 5 年前 | |
[libc++][NFC] Remove excess trailing newlines from most files Testing git commit access. | 6 年前 | |
[libc++] Fix tuple assignment from types derived from a tuple-like The implementation of tuple's constructors and assignment operators currently diverges from the way the Standard specifies them, which leads to subtle cases where the behavior is not as specified. In particular, a class derived from a tuple-like type (e.g. pair) can't be assigned to a tuple with corresponding members, when it should. This commit re-implements the assignment operators (BUT NOT THE CONSTRUCTORS) in a way much closer to the specification to get rid of this bug. Most of the tests have been stolen from Eric's patch https://reviews.llvm.org/D27606. As a fly-by improvement, tests for noexcept correctness have been added to all overloads of operator=. We should tackle the same issue for the tuple constructors in a future patch - I'm just trying to make progress on fixing this long-standing bug. PR17550 rdar://15837420 Differential Revision: https://reviews.llvm.org/D50106 | 5 年前 | |
[libc++][NFC] Consistently use newline between license and include guard | 3 年前 | |
[libcxx] [test] Make set_windows_crt_report_mode.h more explicit This header is included when building with a debug CRT in MSVC/Clang-cl environments. By default, failed asserts with the debug CRT pops up a blocking dialog box alerting the user about the failed assert. When running more than one test in an automated fashion, this isn't ideal. This header tries to run initializers to set the behaviour of the failed asserts to print a message to the console, just like the default is in release mode. This is previously done by setting the reporting mode to _CRTDBG_MODE_DEBUG, which means outputting to the debugger's output window. In some setups, this is enough for making it work, but in others it instead can pop up a dialog asking for which debugger to use. Instead set the mode explicitly to _CRTDBG_MODE_FILE and set the destination to be explicitly to stderr. For setups where the previous code worked correctly, it doesn't make any difference other than that a failed assert prints an additional "abort() has been called" message that wasn't printed before. Differential Revision: https://reviews.llvm.org/D155823 | 3 年前 | |
[NFC][libc++][format] Prepare unit tests. Before implementing P2216's format-string adjust the unit tests. After P2216 the format* functions require a compile-time string literal. This changes prepares the tests. Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D122534 | 4 年前 | |
[libc++][NFC] Consistently use newline between license and include guard | 3 年前 | |
Implement syncstream (p0053) This patch implements std::basic_syncbuf and std::basic_osyncstream as specified in paper p0053r7. ~~For ease of reviewing I am submitting this patch before submitting a patch for std::basic_osyncstream. ~~ ~~Please note, this patch is not 100% complete. I plan on adding more tests (see comments), specifically I plan on adding tests for multithreading and synchronization.~~ Edit: I decided that it would be far easier for me to keep track of this and make changes that affect both std::basic_syncbuf and std::basic_osyncstream if both were in one patch. The patch was originally written by @zoecarver Implements - P0053R7 - C++ Synchronized Buffered Ostream - LWG-3127 basic_osyncstream::rdbuf needs a const_cast - LWG-3334 basic_osyncstream move assignment and destruction calls basic_syncbuf::emit() twice - LWG-3570 basic_osyncstream::emit should be an unformatted output function - LWG-3867 Should std::basic_osyncstream's move assignment operator be noexcept? Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D67086 | 2 年前 | |
Reland: [libc++][format] P2637R3: Member visit (std::basic_format_arg) #76449 (#79032) Deleted the offending test case. libcxx/test/std/utilities/format/format.arguments/format.arg/visit.return_type.pass.cpp lines: 134-135: > test<Context, bool, long>(true, 192812079084L); test<Context, bool, long>(false, 192812079084L); Relands: https://github.com/llvm/llvm-project/pull/76449 Reverted in: https://github.com/llvm/llvm-project/commit/02f95b77515fe18ed1076b94cbb850ea0cf3c77e --------- Co-authored-by: Zingam <zingam@outlook.com> | 2 年前 | |
[libc++] Adds a global private constructor tag. (#87920) This removes the similar tags used in the chrono tzdb implementation. Fixes: https://github.com/llvm/llvm-project/issues/85432 | 2 年前 | |
[libc++] Fix take_view::__sentinel's operator== (#74655) * Fix take_view::__sentinel's operator== * Rename ranges/range.adaptors/range.take/sentinel/base.pass.cpp directory to ranges/range.adaptors/range.take/range.take.sentinel/base.pass.cpp * Add ***full*** test coverage for take_view::__sentinel's operator== * Drive-by: fix comment in base.pass.cpp test * Close #55211 | 2 年前 | |
[libc++] Qualifies size_t. This has been done using the following command find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)size_t)|\1std::\2|' \{} \; And manually removed some false positives in std/depr/depr.c.headers. The std module doesn't export ::size_t, this is a preparation for that module. Reviewed By: ldionne, #libc, EricWF, philnik Differential Revision: https://reviews.llvm.org/D146088 | 3 年前 | |
[libc++][test] Cleanup typos and unnecessary semicolons (#73435) I've structured this into a series of commits for even easier reviewing, if that helps. I could easily split this up into separate PRs if desired, but as this is low-risk with simple edits, I thought one PR would be easiest. * Drop unnecessary semicolons after function definitions. * Cleanup comment typos. * Cleanup static_assert typos. * Cleanup test code typos. + There should be no functional changes, assuming I've changed all occurrences. * ~~Fix massive test code typos.~~ + This was a real problem, but needed more surgery. I reverted those changes here, and @philnik777 is fixing this properly with #73444. * clang-formatting as requested by the CI. | 2 年前 | |
libcxx: Rename .hpp files in libcxx/test/support to .h LLVM uses .h as its extension for header files. Files renamed using: for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done References to the files updated using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do a=$(basename $f); echo $a; rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/"; done HPP include guards updated manually using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do echo ${f%.hpp}.h ; done | xargs mvim Differential Revision: https://reviews.llvm.org/D66104 llvm-svn: 369481 | 6 年前 | |
[libc++][PSTL] Overhaul exceptions handling This makes exception handling a lot simpler, since we don't have to convert any exceptions this way. Is also properly handles all the user-thrown exceptions. Reviewed By: ldionne, #libc Spies: arichardson, mstorsjo, libcxx-commits Differential Revision: https://reviews.llvm.org/D154238 | 2 年前 | |
[NFC][libc++] Requests PR at GitHub instead of Phabricator. | 2 年前 | |
[NFC][libc++] Requests PR at GitHub instead of Phabricator. | 2 年前 | |
[libc++][spaceship] Implements X::iterator container requirements. (#99343) This implements the requirements for the container iterator requirements for array, deque, vector, and vector<bool>. Implements: - LWG3352 strong_equality isn't a thing Implements parts of: - P1614R2 The Mothership has Landed Fixes: https://github.com/llvm/llvm-project/issues/62486 | 2 年前 | |
[libc++] [test] Fix __has_include usage, expand condvarany and spaceship coverage (#94120) Three unrelated, small improvements: * test_macros.h was incorrectly saying __has_include("<version>") instead of __has_include(<version>). + This caused <ciso646> to always be included (noticed because MSVC's STL emitted a deprecation warning). + I searched all of LLVM and found no other occurrences. * thread.condition.condvarany/wait_for_pred.pass.cpp forgot to test anything. + I followed what wait_for.pass.cpp is testing. * Uncomment spaceship test coverage. | 2 年前 | |
[libc++][NFC] Centralize test for support of == and != in ranges (#78481) Previously, tests for whether comparison using == was supported by iterators derived from ranges adaptors was spread throughout the testing codebase. This PR centralizes the implementation of those tests. | 2 年前 | |
[libc++] Qualifies size_t. This has been done using the following command find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)size_t)|\1std::\2|' \{} \; And manually removed some false positives in std/depr/depr.c.headers. The std module doesn't export ::size_t, this is a preparation for that module. Reviewed By: ldionne, #libc, EricWF, philnik Differential Revision: https://reviews.llvm.org/D146088 | 3 年前 | |
[libc++] [P0919] Some belated review on D87171. - Simplify the structure of the new tests. - Test const containers as well as non-const containers, since it's easy to do so. - Remove redundant enable-iffing of helper structs' member functions. (They're not instantiated unless they're called, and who would call them?) - Fix indentation and use more consistent SFINAE method in <unordered_map>. - Add _LIBCPP_INLINE_VISIBILITY on some swap functions. Differential Revision: https://reviews.llvm.org/D109011 | 4 年前 | |
[libc++][chrono] Adds tzdb_list implementation. This is the first step to implement time zone support in libc++. This adds the complete tzdb_list class and a minimal tzdb class. The tzdb class only contains the version, which is used by reload_tzdb. Next to these classes it contains documentation and build system support needed for time zone support. The code depends on the IANA Time Zone Database, which should be available on the platform used or provided by the libc++ vendors. The code is labeled as experimental since there will be ABI breaks during development; the tzdb class needs to have the standard headers. Implements parts of: - P0355 Extending <chrono> to Calendars and Time Zones Addresses: - LWG3319 Properly reference specification of IANA time zone database Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D154282 | 2 年前 | |
[libcxx][test] compiler options are non-portable ... it's easier to suppress warnings internally, where we can detect the compiler. * Rename TEST_COMPILER_C1XX to TEST_COMPILER_MSVC * Rename all TEST_WORKAROUND_C1XX_<meow> to TEST_WORKAROUND_MSVC_<meow> Differential Revision: https://reviews.llvm.org/D117422 | 4 年前 | |
Update more file headers across all of the LLVM projects in the monorepo to reflect the new license. These used slightly different spellings that defeated my regular expressions. 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: 351648 | 7 年前 | |
[libc++] Forward to std::{,w}memchr in std::find Reviewed By: #libc, ldionne Spies: Mordante, libcxx-commits, ldionne, mikhail.ramalho Differential Revision: https://reviews.llvm.org/D144394 | 3 年前 | |
[libc++][NFC] Consistently use newline between license and include guard | 3 年前 | |
[libc++] Implement P2273R3 ( constexpr unique_ptr) Reviewed By: mordante, #libc Differential Revision: https://reviews.llvm.org/D131315 | 3 年前 | |
[libc++][ranges] Implement the changes to container adaptors from P1206 ( ranges::to): - add the from_range_t constructors and the related deduction guides; - add the push_range member function. (Note: this patch is split from https://reviews.llvm.org/D142335) Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D149829 | 3 年前 | |
[libc++][NFC] Consistently use newline between license and include guard | 3 年前 | |
[libc++] Remove experimental pmr headers now shipped in mainline (#73172) Several experimental headers around std::pmr have been slated for removal for a while now. This patch actually performs the removal and cleanups from the code base. | 2 年前 | |
| 2 年前 | ||
[libc++] Get rid of _LIBCPP_HAS_OPEN_WITH_WCHAR in the test suite Differential Revision: https://reviews.llvm.org/D135163 | 3 年前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 2 年前 | ||
| 4 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 4 年前 | ||
| 6 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 7 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 4 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 4 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 6 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 4 年前 | ||
| 2 年前 | ||
| 4 年前 | ||
| 7 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 |