Commit Graph

7838 Commits

Author SHA1 Message Date
Louis Dionne b408bbbf5b [libc++] Avoid conflating stderr and stdout in the DSL
This is a workaround until https://reviews.llvm.org/D81892 is merged
and the internal Lit shell stops conflating error output with normal
output. Without this, any program that writes to stderr will trip up
the programOutput function, because it will pick up the '# command stderr:'
string and think it's part of the command's stdout.

rdar://81056048

Differential Revision: https://reviews.llvm.org/D107912
2021-08-11 17:06:56 -04:00
Louis Dionne 7c81024a06 [libc++] Remove workarounds for missing __builtin_addressof
All supported compilers implement __builtin_addressof. Even MSVC implements
addressof as a simple call to __builtin_addressof, so it would work if we
were to port libc++ to that compiler.

Differential Revision: https://reviews.llvm.org/D107905
2021-08-11 17:05:12 -04:00
Arthur O'Dwyer c1a8f12873 [libc++] Restore `basic_ios`'s implicit conversion to `bool` in C++03 mode.
efriedma noted that D104682 broke this test case, reduced from SPEC2006.

    #include <istream>
    bool a(std::istream a) {
        return a.getline(0,0) == 0;
    }

We can unbreak it by restoring the conversion to something-convertible-to-bool.
We chose `void*` in order to match libstdc++.

For more ancient history, see PR19460: https://bugs.llvm.org/show_bug.cgi?id=19460

Differential Revision: https://reviews.llvm.org/D107663
2021-08-11 13:36:29 -04:00
Mark de Wever d2bc4fa3c7 [libc++][doc] Improve contributor documentation.
Addresses the post-commit review comments of D107596.
2021-08-11 17:33:54 +02:00
Louis Dionne 15071d2945 [libc++] Remove _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
All supported compilers have implemented __has_unique_object_representations
for a while, so it's reasonable to remove the workaround.

Differential Revision: https://reviews.llvm.org/D107834
2021-08-11 10:11:40 -04:00
Louis Dionne 7be03cc782 [libc++] Remove _LIBCPP_HAS_NO_IS_AGGREGATE
All supported compilers have been supporting __is_aggregate for a long
time now, so it's reasonable to remove this workaround.

Differential Revision: https://reviews.llvm.org/D107833
2021-08-11 10:10:53 -04:00
Louis Dionne 89a7bdb1f3 [libc++] Add the __bind_back and __compose helpers
Those are going to be used to implement range adaptors,
see D107098 for details.

Differential Revision: https://reviews.llvm.org/D107785
2021-08-11 10:08:20 -04:00
Arthur O'Dwyer e27f364c61 [libc++] IWYU to fix Modules complaints in <__ranges/reverse_view.h>.
And now we can use granular concepts headers!
2021-08-10 22:02:41 -04:00
Arthur O'Dwyer 58915667d0 [libc++][modularisation] Split up <concepts> into granular headers.
This is the complete split of <concepts>, with nothing left in the main header.

Differential Revision: https://reviews.llvm.org/D107584
2021-08-10 22:02:41 -04:00
zoecarver f9e58f35e9 [libcxx][ranges] Add `views::counted` CPO.
Differential Revision: https://reviews.llvm.org/D106923
2021-08-10 16:42:28 -07:00
Mark de Wever 1123100a16 [libcxx] Remove _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
All supported compilers should support
_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED so this can be removed.

Reviewed By: ldionne, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D107239
2021-08-10 18:59:55 +02:00
Louis Dionne ce96d81c47 [libc++][NFC] Simplify tests for bind_front 2021-08-10 11:57:51 -04:00
Martin Storsjö bb2a92e66e [libcxx] [test] Convert an XFAIL: LIBCXX-WINDOWS-FIXME into XFAIL: msvc
This one already had a proper explanation why it fails, which is due to
differences by design in MSVC mode. This isn't a fixme, so degrade the
annotation to a more permanent "XFAIL: msvc" instead.

Differential Revision: https://reviews.llvm.org/D107758
2021-08-10 11:06:18 +03:00
Martin Storsjö 4baf369cde [libcxx] [test] Fix the new_faligned_allocation.pass.cpp test for MSVC
Such environments do have aligned allocation functions these days, but
the RTTI type name test needs to be adjusted for the MSVC C++ ABI.

Differential Revision: https://reviews.llvm.org/D107757
2021-08-10 11:06:02 +03:00
Martin Storsjö 128b2136ec [libcxx] [test] Generalize defines for skipping allocation checks
This allows waiving the right amount of asserts on Windows and zOS.
This should supersede D107124 and D105910.

Differential Revision: https://reviews.llvm.org/D107755
2021-08-10 11:05:00 +03:00
zoecarver 9d982c67ba [libcxx][ranges] Add `ranges::reverse_view`.
Differential Revision: https://reviews.llvm.org/D107096
2021-08-09 15:09:59 -07:00
Louis Dionne 706bd129b3 [libc++][NFC] Remove workaround for variadic templates in C++03
That's not necessary anymore, since we always build the dylib with
C++11 capabilities nowadays.

Differential Revision: https://reviews.llvm.org/D107772
2021-08-09 18:05:46 -04:00
Louis Dionne f599e7a789 [libc++] Refactor __perfect_forward, bind_front and not_fn
This patch fixes the constrains on the __perfect_forward constructor
and its call operators, which were incorrect. In particular, it makes
sure that we closely follow [func.require], which basically says that
we must deliver the bound arguments with the appropriate value category
or make the call ill-formed, but not silently fall back to using a
different value category.

As a fly-by, this patch also:
- Adds types __bind_front_t and __not_fn_t to make the result of
  calling bind_front and not_fn more opaque, and improve diagnostics
  for users.
- Adds a bunch of tests for bind_front and remove some that are now
  redundant.
- Adds some missing _LIBCPP_HIDE_FROM_ABI annotations.

Immense thanks to @tcanens for raising awareness about this issue, and
providing help with the = delete bits.

Differential Revision: https://reviews.llvm.org/D107199
2021-08-09 15:32:00 -04:00
Louis Dionne d232ec3c2a [libc++] Add timeout to BuildKite jobs
We just had a case where a build bot stalled in an infinite loop during
testing, and the whole pipeline got stuck. To avoid that from happening
in the future, use a timeout on BuildKite jobs.

Differential Revision: https://reviews.llvm.org/D107765
2021-08-09 15:31:04 -04:00
Mark de Wever 6f85d9e104 [libc++][doc] Improve contributor documentation.
Shorty before branching  LLVM 13 a new CMake option was added. This
option `LIBCXX_ENABLE_INCOMPLETE_FEATURES` lacks the contributor
documentation. This patch rectifies that issue.

Differential Revision: https://reviews.llvm.org/D107596
2021-08-09 18:26:07 +02:00
Mark de Wever 96ed451f8d [libc++][NFC] Remove MSVC specific code.
Switching `__builtin_clzll`  to `__libcpp_clz` should work on all
platforms and no longer require MSVC specific code.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D107709
2021-08-09 18:13:49 +02:00
Arthur O'Dwyer 3d2d3b3e7a [libc++] [test] IWYU in <concepts> tests. 2021-08-09 09:39:36 -04:00
Arthur O'Dwyer f221d905b1 [libc++] IWYU to fix Modules complaints about _LIBCPP_ASSERT. NFCI.
This fixes all places that used _LIBCPP_ASSERT without including <__debug>.

    git grep -l _LIBCPP_ASSERT | xargs git grep -L __debug
2021-08-06 09:20:59 -04:00
Arthur O'Dwyer ac42f76090 [libc++] s/_VSTD::_IsSame/_IsSame/. NFCI. 2021-08-05 23:29:53 -04:00
Arthur O'Dwyer 892990c56c [libc++] IWYU to fix complaints when compiling with Modules. NFCI.
Differential Revision: https://reviews.llvm.org/D107583
2021-08-05 14:30:08 -04:00
David Spickett e517a2405f Revert "[libcxx][CI] Work around Arm buildkite failures"
This reverts commit f8bef47348.

Buildkite agent 3.32.0 includes a fix for the PATH issue.
https://github.com/buildkite/agent/releases/tag/v3.32.0

Differential Revision: https://reviews.llvm.org/D107172
2021-08-02 09:32:08 +01:00
zoecarver 3df649e619 [libcxx][docs] Take locks on the last three views. 2021-07-30 15:08:01 -07:00
Mark de Wever d618a1cc5c [libc++] Improve LIBCXX_ENABLE_INCOMPLETE_FEATURES.
@tcanens pointed out the current behavior of the macro breaks the usage
pattern described in http://wg21.link/SD6
```
#  if __has_include(<optional>)
#    include <optional>
#    if __cpp_lib_optional >= 201606
#      define have_optional 1
#    endif
```

To support this usage pattern the hard errror is removed. Instead the
header includes nothing but the `<version>` header.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D107134
2021-07-30 14:36:03 -04:00
zoecarver 481ad59b9f [libcxx][ranges] Add `std::ranges::single_view`.
Differential Revision: https://reviews.llvm.org/D106840
2021-07-30 10:53:20 -07:00
Louis Dionne 7b3ada712a [libc++][NFC] Fix copy-paste error in the transform_view tests 2021-07-30 09:52:28 -04:00
Louis Dionne c99f5b2af1 [libc++] Handle arrays in std::destroy_at
Also, improve tests for std::destroy and std::destroy_n so that they
check for array support.

These changes are part of http://wg21.link/p0896 (the One Ranges proposal).

Differential Revision: https://reviews.llvm.org/D106916
2021-07-30 09:39:36 -04:00
Louis Dionne 9efffe8278 [libc++][NFC] Make private header generation CMake comment more consistent 2021-07-29 14:17:04 -04:00
Mark de Wever 92b758cf3d [libcxx][doc] Update the build documentation.
These are the hunks of
  D106770 [libc++][doc] Update the release notes
that are relevant for main.
2021-07-29 07:57:10 +02:00
Arthur O'Dwyer d4840175c9 [libc++] Remove excess whitespace in synopsis comment. NFCI. 2021-07-29 01:34:31 -04:00
Ruslan Arutyunyan 61c35fb0c2 [libc++][modularisation] Split <compare> into internal headers.
Differential Revision: https://reviews.llvm.org/D106107
2021-07-28 22:28:26 -04:00
Arthur O'Dwyer 20c6ddc5bc [libc++] Remove unused variables in generate_private_header_tests.py. NFCI. 2021-07-28 22:28:25 -04:00
Jason Liu 363a8a0598 [libc++] money_get::do_get() set failbit and eofbit if iterator begin equals end
Summary:
Currently, if we pass in the same iterator for begin and end,
the long double version of do_get would throw a runtime error.

However, according to standard (https://eel.is/c++draft/locale.money.get#virtuals-1),
we should set the failbit and eofbit when no more characters are available.

Differential Revision: https://reviews.llvm.org/D100510
2021-07-28 22:23:09 -04:00
Arthur O'Dwyer 3894a8a476 [libc++] Implement the resolutions of LWG3506 and LWG3522.
Implement the changes in all language modes.

LWG3506 "Missing allocator-extended constructors for priority_queue"
makes the following changes:
- New allocator-extended constructors for priority_queue.
- New deduction guides targeting those constructors.

LWG3522: "Missing requirement on InputIterator template parameter
for priority_queue constructors". The iterator parameter should be
constrained to actually be an iterator type. `priority_queue{1,2}`
should be SFINAE-friendly ill-formed.

Also, do a drive-by fix in the allocator-extended move constructor:
there's no need to do a `make_heap` after moving from `__q.c` into
our own `c`, because that container was already heapified when it
was part of `__q`. [priqueue.cons.alloc] actually specifies the
behavior and does *not* mention calling `make_heap`. I think this
was just a copy-paste thinko. It dates back to the initial import
of libc++.

Differential Revision: https://reviews.llvm.org/D106824
Differential Revision: https://reviews.llvm.org/D106827
2021-07-28 21:15:20 -04:00
Louis Dionne 6929bd6d00 [libc++] Add UNSUPPORTED for clang-14 since the underlying bug hasn't been fixed yet
This started breaking in the CI because we bumped the Clang version to 14,
which requires adjusting the markup in the test suite. I think it's actually
nice the we need to do that and that it doesn't happen automatically, since
it serves as a reminder that this is broken in Clang.
2021-07-28 16:41:22 -04:00
zoecarver 0f4b41e038 [libcxx][ranges] Add ranges::take_view.
Differential Revision: https://reviews.llvm.org/D106507
2021-07-28 12:14:21 -07:00
Mark de Wever 4e65688571 [libc++][nfc] Improve error diagnostics.
The error message for disabled filesystem and locale support is now done
in the same fashion as ranges and format in D106763.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D106935
2021-07-28 17:57:23 +02:00
David Spickett 4fd42e2e80 [libcxx] Bump __libcpp_version to 14 after branch
This was missed in 08c766a731
and caused test failures in the buildkite bots:
libcpp_version.pass.cpp:22:1:
error: static_assert failed due to requirement '14000 == libcpp_version'
"_LIBCPP_VERSION doesn't match __libcpp_version
2021-07-28 11:07:06 +00:00
Tom Stellard 08c766a731 Bump the trunk major version to 14
and clear the release notes.
2021-07-27 21:58:25 -07:00
Louis Dionne 2e4755ff60 [libc++] Fix a few warnings in system headers with GCC
This isn't fixing all of them, but at least it's making some progress.

Differential Revision: https://reviews.llvm.org/D106283
2021-07-27 20:09:01 -04:00
zoecarver 8a48e6dda9 [libcxx][ranges] Add `counted_iterator`.
Differential Revision: https://reviews.llvm.org/D106205
2021-07-27 15:50:11 -07:00
zoecarver b187e0389d [libcxx][nfc] Delete `cpp20_input_iterator`'s default constructor.
This will make it conform only to the minimum requirements for an `input_iterator`.
2021-07-27 15:50:11 -07:00
Mark de Wever 71909de374 [libc++] Disable incomplete library features.
Adds a new CMake option to disable the usage of incomplete headers.
These incomplete headers are not guaranteed to be ABI stable. This
option is intended to be used by vendors so they can avoid their users
from code that's not ready for production usage.

The option is enabled by default.

Differential Revision: https://reviews.llvm.org/D106763
2021-07-27 22:37:35 +02:00
Nancy Wang 3dc39f2829 [SystemZ][z/OS][libcxx]: Disable align_val_t test cases on z/OS
align_val_t is not supported on z/OS, it causes failure on z/OS. similar to https://reviews.llvm.org/rGd0fe294729a2ac45625ed45a5619c8405a14db49 , we will need to disable those test cases on z/OS platform.

Differential Revision: https://reviews.llvm.org/D106810
2021-07-27 15:22:30 -04:00
Louis Dionne 21c24ae902 [runtimes] Always build libc++, libc++abi and libunwind with -fPIC
Building the libraries with -fPIC ensures that we can link an executable
against the static libraries with -fPIE. Furthermore, there is apparently
basically no downside to building the libraries with position independent
code, since modern toolchains are sufficiently clever.

This commit enforces that we always build the runtime libraries with -fPIC.
This is another take on D104327, which instead makes the decision of whether
to build with -fPIC or not to the build script that drives the runtimes'
build.

Fixes http://llvm.org/PR43604.

Differential Revision: https://reviews.llvm.org/D104328
2021-07-27 14:19:05 -04:00
Louis Dionne 45478619e3 [libc++] CI: Run -std=c++03 on Clang ToT
Differential Revision: https://reviews.llvm.org/D106104
2021-07-27 14:13:28 -04:00