Commit Graph

8522 Commits

Author SHA1 Message Date
Casey Carter 67d483aba2 [libcxx][test] Use TEST_HAS_BUILTIN in test code
... rather than using `__has_builtin` directly. This both (1) allows a compiler that doesn't speak `__has_builtin` to workaround with preprocessor magic, and (2) avoids diagnostics about things that look like function like macros after `#if` but are not.
2022-01-20 01:47:29 -08:00
John Ericson 429a717ea5 [cmake] Move HandleOutOfTreeLLVM to common cmake utils
This is better than libunwind and libcxxabi fishing it out of libcxx's
module directory.

It is done in prepartion for a better version of D117537 which deduplicates
CMake logic instead of just renaming to avoid a name clash.

Reviewed By: phosek, #libunwind, #libc_abi, Ericson2314

Differential Revision: https://reviews.llvm.org/D117617
2022-01-19 22:05:23 +00:00
Casey Carter 3a1b178a0b [libcxx][test] Portably test that `{w,}format_context` is a specialization of `basic_format_context`
Differential Revision: https://reviews.llvm.org/D117606
2022-01-19 11:36:29 -08:00
Alex Richardson 89103bd2f0 [libc++] Fix GDB pretty printers when GDB uses Python 2.7
The gdb_pretty_printer_test.sh fails if GDB was built against Python 2.7
since Python 2 expects iterators to have a next() method rather than
using __next__. To make the pretty printers work with both Python 2 and 3
we can simply set next to __next__ in the iterator classes.

Python 2.7 support was removed in f46f93b478,
so this partially reverts that commit. While Python 2.7 is EOL, it
appears there are still many GDB installations that are linked against
Python 2.7, so we may want to keep this tiny amount of compat code
around for a while longer.

Without this commit the tests fails with errors such as:
```
GDB printed:
   u"std::tuple containingTypeError: iter() returned non-iterator of type '_Children'\n"
Value should match:
   u'std::tuple containing = {[1] = 2, [2] = 3, [3] = 4}'
```

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D117470
2022-01-19 10:11:45 +00:00
Casey Carter a94739985b [libcxx][test] test _LIBCPP_VERSION with #ifdef, not #if 2022-01-18 19:37:03 -08:00
Louis Dionne a00f3e2d09 [libc++] Re-enable the _BitInt test for std::atomic on Clang 14
It should now work since the Clang on CI nodes has been updated.

Differential Revision: https://reviews.llvm.org/D115256
2022-01-18 21:32:22 -05:00
Casey Carter f105d98443 [libcxx][test] `unordered_meow` iterators are not portably non-bidi
MSVCSTL's are actually bidirectional.

Differential Revision: https://reviews.llvm.org/D117369
2022-01-18 11:43:21 -08:00
Casey Carter 4e00a1921f [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
2022-01-18 11:34:57 -08:00
Nikolas Klauser 275e7d197c [libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <unordered_map>
Use `_LIBCPP_DEBUG_ASSERT` in <unordered_map>

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117401
2022-01-18 20:31:02 +01:00
Nikolas Klauser 6322cb4890 [libc++][test] test in_in_result convertible requirements
Currently it is not checked that operator in_in_result<II1, II2>() SFINAEs away properly

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117517
2022-01-18 20:29:51 +01:00
Alex Brachet 1dbe32dd9c [libc++] Use reserved identifier for template parameter
`T` is not a valid identifier for libc++ to use, use `_Tp` instead. Caught from D116957

Reviewed By: Quuxplusone

Differential Revision: https://reviews.llvm.org/D117582
2022-01-18 19:20:25 +00:00
Mark de Wever 8f4a6187f2 [libc++] Adds a test for std::fill_n.
The function `std::fill` requires a ForwardIterator, but `std::fill_n`
only requires an OutputIterator. Adds a test to validate `std::fill_n`
works with an OutputIterator.

Noticed this while working on LWG3539
format_to must not copy models of output_iterator<const charT&>

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D117395
2022-01-18 19:27:02 +01:00
Arthur O'Dwyer 3049d51e98 [libc++] [test] Use hidden friends consistently in the test iterators.
Differential Revision: https://reviews.llvm.org/D117397
2022-01-18 13:04:40 -05:00
Louis Dionne a9bfb4c4f4 [libc++] Refactor stride_counting_iterator
Instead of storing the wrapped iterator inside the stride_counting_iterator,
store its base so we can have e.g. a stride_counting_iterator of an
input_iterator (which was previously impossible because input_iterators
are not copyable). Also a few other simplifications in stride_counting_iterator.

As a fly-by fix, remove the member base() functions, which are super
confusing.

Differential Revision: https://reviews.llvm.org/D116613
2022-01-18 12:24:05 -05:00
Louis Dionne df51be85e4 [libc++] Split a few utilities out of __threading_support
This change is the basis for a further refactoring where I'm going to
split up the various implementations we have in __threading_support to
make that code easier to understand.

Note that I had to make __convert_to_timespec a template to break
circular dependencies. Concretely, we never seem to use it with anything
other than ::timespec, but I am wary of hardcoding that assumption as
part of this change, since I suspect there's a reason for going through
these hoops in the first place.

Differential Revision: https://reviews.llvm.org/D116944
2022-01-18 12:23:44 -05:00
Louis Dionne 4afa9c1726 [libc++] Persistently cache memoized operations during Lit configuration
When invoking Lit repeatedly, we perform all the configuration checks
over and over again, which takes a lot of time. This patch allows caching
the result of configuration checks persistently across Lit invocations to
speed this up.

In theory, this should still be functionally correct since the cache
key should contain everything that determines the output of the
configuration check. However, in cases where e.g. the compiler has
changed but is at the same path as previously, the Lit configuration
checks will be cached even though technically the cache should have
been invalidated.

Differential Revision: https://reviews.llvm.org/D117361
2022-01-18 10:44:23 -05:00
John Ericson f16a4a034a [libcxx][libcxxabi][libunwind][cmake] Use `GNUInstallDirs` to support custom installation dirs
I am breaking apart D99484 so the cause of build failures is easier to
understand.

Differential Revision: https://reviews.llvm.org/D117417
2022-01-18 06:44:57 +00:00
Arthur O'Dwyer 459b4b725f [libc++] [API BREAK] Change `fs::path::iterator::iterator_category` to `input_iterator_tag`.
This essentially reverts e02ed1c255 and puts in a new fix, which makes `path::iterator`
a true C++20 `bidirectional_iterator`, but downgrades it to an `input_iterator` in C++17.

Fixes #37852.

Differential Revision: https://reviews.llvm.org/D116489
2022-01-17 16:33:23 -05:00
Arthur O'Dwyer 5820322cb1 [libc++] [test] UNSUPPORTED my new uniform_int_distribution test on MinGW.
After 9fe67486cc, this test fails on MinGW for some reason.
https://buildkite.com/llvm-project/libcxx-ci/builds/7922#9e267294-441d-4b79-8a19-30fdb5599c1f
All it says in the build output is

    note: command had no output on stdout or stderr
    error: command failed with exit status: 4294967295
2022-01-17 16:32:44 -05:00
Nikolas Klauser c10cbb243c [libc++] Install clang-tidy in docker containers
Install clang-tidy

Reviewed By: ldionne, #libc

Spies: sammccall, mgorny, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D117268
2022-01-17 21:05:42 +01:00
Nikolas Klauser caf5548c7c [libc++] Introduce __debug_db_insert_i()
Introduce `__debug_db_insert_i()`

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117410
2022-01-17 20:31:21 +01:00
Arthur O'Dwyer 0e03c62b4c [libc++] [bench] Stop using uniform_int_distribution<char> in benchmarks.
Reviewed as part of D114920.
2022-01-17 14:31:33 -05:00
Arthur O'Dwyer 01193cae1c [libc++] [doc] Fix a Sphinx error in ReleaseNotes.rst (I hope) 2022-01-17 14:29:59 -05:00
Nikolas Klauser 311207bbea [libc++][P2321R2] Add specializations of basic_common_reference and common_type for tuple
Add specializations of `basic_common_reference` and `common_type` for `tuple`

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116538
2022-01-17 19:49:57 +01:00
Nikolas Klauser d7630b37ce [libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <vector>
Use `_LIBCPP_DEBUG_ASSERT` in `<vector>`

Reviewed By: Quuxplusone, ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117402
2022-01-17 19:28:16 +01:00
Arthur O'Dwyer d96a5042d6 [libc++] [test] Improve the tests for std::assignable_from.
Fixes #50060.

Differential Revision: https://reviews.llvm.org/D117434
2022-01-17 12:11:49 -05:00
Arthur O'Dwyer 9fe67486cc [libc++] [test] Improve the test for `uniform_int_distribution<T>`.
Extracted from https://reviews.llvm.org/D114920
2022-01-17 10:31:10 -05:00
Arthur O'Dwyer 0359b85c61 [libc++] [ABI BREAK] Conform lognormal_distribution::param_type.
Fixes #52906.

Differential Revision: https://reviews.llvm.org/D116344
2022-01-17 10:22:41 -05:00
Arthur O'Dwyer e93f98f09c [libc++] [test] Check for another kind of modulemap typo in lint_modulemap.sh.py.
Verify that the name of the private submodule matches the name of the detail header.

Differential Revision: https://reviews.llvm.org/D117438
2022-01-17 10:20:34 -05:00
John Ericson da77db58d7 Revert "[cmake] Use `GNUInstallDirs` to support custom installation dirs."
https://lab.llvm.org/buildbot/#/builders/46/builds/21146 Still have
this odd error, not sure how to reproduce, so I will just try breaking
up my patch.

This reverts commit 4a678f8072.
2022-01-16 05:48:30 +00:00
John Ericson 4a678f8072 [cmake] Use `GNUInstallDirs` to support custom installation dirs.
This is the original patch in my GNUInstallDirs series, now last to merge as the final piece!

It arose as a new draft of D28234. I initially did the unorthodox thing of pushing to that when I wasn't the original author, but since I ended up

 - Using `GNUInstallDirs`, rather than mimicking it, as the original author was hesitant to do but others requested.

 - Converting all the packages, not just LLVM, effecting many more projects than LLVM itself.

I figured it was time to make a new revision.

I have used this patch series (and many back-ports) as the basis of https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS), which was merged last spring (2021). It looked like people were generally on board in D28234, but I make note of this here in case extra motivation is useful.

---

As pointed out in the original issue, a central tension is that LLVM already has some partial support for these sorts of things. Variables like `COMPILER_RT_INSTALL_PATH` have already been dealt with. Variables like `LLVM_LIBDIR_SUFFIX` however, will require further work, so that we may use `CMAKE_INSTALL_LIBDIR`.

These remaining items will be addressed in further patches. What is here is now rote and so we should get it out of the way before dealing more intricately with the remainder.

Reviewed By: #libunwind, #libc, #libc_abi, compnerd

Differential Revision: https://reviews.llvm.org/D99484
2022-01-16 05:33:07 +00:00
Nikolas Klauser d3e49a41b1 [libc++] Add _LIBCPP_HIDE_FROM_ABI to in_in_result
Add `_LIBCPP_HIDE_FROM_ABI` to `in_in_result` conversion operators

Reviewed By: Quuxplusone, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117399
2022-01-15 20:30:08 +01:00
Arthur O'Dwyer cba72e4ce2 [libc++] Normalize some whitespace in preparation for D116570. NFC. 2022-01-15 12:20:33 -05:00
Mark de Wever 3ba96cb2c9 [libc++] Adds tests for LWG-3373.
The code in libc++ already satisfy the requirements of LWG-3373. Since
the issue was written to specifically allow the types to be used in
structured bindings, tests have been added to validate the new
requirement.

Implements
LWG-3373 {to,from}_chars_result and format_to_n_result need the "we really mean what we say" wording

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D117337
2022-01-15 13:46:53 +01:00
John Ericson 6e52bfe09d Revert "[cmake] Use `GNUInstallDirs` to support custom installation dirs."
Sorry for the disruption, I will try again later.

This reverts commit efeb501970.
2022-01-15 07:35:02 +00:00
John Ericson efeb501970 [cmake] Use `GNUInstallDirs` to support custom installation dirs.
This is the original patch in my GNUInstallDirs series, now last to merge as the final piece!

It arose as a new draft of D28234. I initially did the unorthodox thing of pushing to that when I wasn't the original author, but since I ended up

 - Using `GNUInstallDirs`, rather than mimicking it, as the original author was hesitant to do but others requested.

 - Converting all the packages, not just LLVM, effecting many more projects than LLVM itself.

I figured it was time to make a new revision.

I have used this patch series (and many back-ports) as the basis of https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS), which was merged last spring (2021). It looked like people were generally on board in D28234, but I make note of this here in case extra motivation is useful.

---

As pointed out in the original issue, a central tension is that LLVM already has some partial support for these sorts of things. Variables like `COMPILER_RT_INSTALL_PATH` have already been dealt with. Variables like `LLVM_LIBDIR_SUFFIX` however, will require further work, so that we may use `CMAKE_INSTALL_LIBDIR`.

These remaining items will be addressed in further patches. What is here is now rote and so we should get it out of the way before dealing more intricately with the remainder.

Reviewed By: #libunwind, #libc, #libc_abi, compnerd

Differential Revision: https://reviews.llvm.org/D99484
2022-01-15 01:08:35 +00:00
Arthur O'Dwyer 6cc305764f [libc++] [test] Add a test for proper _Uglification of template parameter names.
Merge nasty_macros.h into the new test.

Differential Revision: https://reviews.llvm.org/D116957
2022-01-14 15:50:37 -05:00
Arthur O'Dwyer 0ab54c28f8 [libc++] Further small cleanups of move_iterator.h. NFC.
Differential Revision: https://reviews.llvm.org/D117324
2022-01-14 15:41:45 -05:00
Arthur O'Dwyer c09692a644 [libc++] s/_LIBCPP_INLINE_VISIBILITY/_LIBCPP_HIDE_FROM_ABI/g in move_iterator.h. NFC. 2022-01-14 15:41:02 -05:00
Arthur O'Dwyer 9542c9c599 [libc++] Rename __i to __current_ in move_iterator. NFC. 2022-01-14 15:40:57 -05:00
Louis Dionne cd97aaee5f [libc++] Add missing `<cstddef>` include in span test 2022-01-14 15:07:17 -05:00
Casey Carter ecd64c4e15 [libcxx][test] Properly qualify uses of std::size_t
To silence modular build error https://reviews.llvm.org/harbormaster/unit/view/1854595/
2022-01-14 11:41:27 -08:00
Nikolas Klauser bdd5b94837 [libc++][NFC] Remove clang-diagnostic-c++98-compat-extra-semi warnings in experimental/simd
Force semicolons or remove them in `experimental/simd`

Reviewed By: Quuxplusone, ldionne, Mordante, #libc

Spies: libcxx-commits, miyuki

Differential Revision: https://reviews.llvm.org/D117157
2022-01-14 19:38:33 +01:00
Hui Xie 597b90ebac [libc++] Fix __simple_view concept in std::ranges
Differential Revision: https://reviews.llvm.org/D116808
2022-01-14 12:55:34 -05:00
Arthur O'Dwyer fa244345e1 [libc++] [test] ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS is not supported on AIX.
I believe all four of these failures are directly due to the pattern where
allocations in the dylib are unobserved by the client program. If AIX32 and AIX64
don't support that, we should just disable the ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS
macro on AIX, and then we don't need to XFAIL these tests.

This also means I won't need to XFAIL a dozen other tests in D89057,
which rely heavily on ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS and
also currently fail on AIX.
See https://buildkite.com/llvm-project/libcxx-ci/builds/7669

Differential Revision: https://reviews.llvm.org/D116866
2022-01-14 12:48:04 -05:00
Arthur O'Dwyer 2a11fbb827 [libc++] [NFC] Remove a hard tab from __config. 2022-01-14 12:18:44 -05:00
Muiez Ahmed a1da73961d [SystemZ][z/OS] ASCII/EBCDIC support with no coexistence
The aim of this patch is to break up the larger patch (https://reviews.llvm.org/D111323) to be more upstream friendly. In particular, this patch adds the char encoding sensitive changes but does not use inline namespaces as before. The use of namespaces to build both versions of the library, and localization of error messages will follow in a subsequent patch.

Differential Revision: https://reviews.llvm.org/D114813
2022-01-14 11:37:09 -05:00
Arthur O'Dwyer a8f1a715f0 [libc++] _Uglify some template parameter names. NFCI. 2022-01-14 10:32:04 -05:00
Louis Dionne 5726e55981 [libc++] Modularize <chrono>
I didn't split the calendar bits more than this because there was little
benefit to doing it, and I know our calendar support is incomplete.
Whoever picks up the missing calendar bits can organize these headers
at their leisure.

Differential Revision: https://reviews.llvm.org/D116965
2022-01-14 09:55:29 -05:00
Konstantin Varlamov b6d87773fe [libc++] LWG3171: implement operator<< for filesystem::directory_entry.
Differential Revision: https://reviews.llvm.org/D116642
2022-01-13 20:44:18 -08:00