Commit Graph

5290 Commits

Author SHA1 Message Date
Eric Fiselier 350ee4bb13 Work around GCC 9.0 regression
llvm-svn: 349663
2018-12-19 18:58:22 +00:00
Marshall Clow 8d221b40a7 Add missing include to test. NFC
llvm-svn: 349639
2018-12-19 16:39:04 +00:00
Marshall Clow 5a127cdcbf Portability fix: add missing includes and static_casts. Reviewed as https://reviews.llvm.org/D55777. Thanks to Andrey Maksimov for the patch.
llvm-svn: 349566
2018-12-18 23:19:00 +00:00
Marshall Clow b766eb96ff Rework the C strings tests to use ASSERT_SAME_TYPE. NFC there. Also change cwchar.pass.cpp to avoid constructing a couple things from zero - since apparently they can be enums in some weird C library. NFC there, either, since the values were never used.
llvm-svn: 349522
2018-12-18 19:07:30 +00:00
Louis Dionne c19d729786 [libcxx] Remove XFAILs for older macOS versions
That test doesn't fail anymore since r349378, since the assertions that
r349378 removed must have been bugs in the dylib at some point.

llvm-svn: 349484
2018-12-18 13:46:28 +00:00
Louis Dionne 06caa6d2e6 [libcxx] Handle AppleClang 9 and 10 in XFAILs for aligned allocation tests
I forgot that those don't behave like Clang trunk, again.

llvm-svn: 349427
2018-12-18 00:42:09 +00:00
Louis Dionne afb1d72e7b [libcxx] Properly mark aligned allocation macro test as XFAIL on OS X
This test was initially marked as XFAIL using `XFAIL: macosx10.YY`, and
was then moved to `UNSUPPORTED: macosx10.YY`. The intent is to mark the
test as XFAILing when a deployment target older than macosx10.14 is used,
and the right way to do this is `XFAIL: availability=macosx10.YY`.

llvm-svn: 349426
2018-12-18 00:30:15 +00:00
Louis Dionne c8ca4d8cc1 [libcxx][NFC] Properly indent nested #ifdefs and #defines
I just realized I had always been reading this wrong because of the lack
of indentation, so I'm re-indenting this properly.

llvm-svn: 349408
2018-12-17 22:22:44 +00:00
Eric Fiselier 2a58b11a8a Fix FP comparisons when SSE isn't available
llvm-svn: 349387
2018-12-17 20:17:43 +00:00
Michal Gorny c32d47c6a8 [test] Add target_info for NetBSD, and XFAIL some of locale tests
Add a target_info definition for NetBSD.  The definition is based
on the one used by FreeBSD, with libcxxrt replaced by libc++abi,
and using llvm-libunwind since we need to use its unwinder
implementation to build anyway.

Additionally, XFAIL the 30 tests that fail because of non-implemented
locale features.  According to the manual, NetBSD implements only
LC_CTYPE part of locale handling.  However, there is a locale database
in the system and locale specifications are validated against it,
so it makes sense to list the common locales as supported.

If I'm counting correctly, this change enables additional 43 passing
tests.

Differential Revision: https://reviews.llvm.org/D55767

llvm-svn: 349379
2018-12-17 19:14:08 +00:00
Michal Gorny 916bf993a2 [test] [re.traits] Remove asserts failing due to invalid UTF-8
Remove the two test cases for \xDA and \xFA with UTF-8 locale, as both
characters alone are invalid in UTF-8 (short sequences).  Upon removing
them, the test passes on Linux again (and also on NetBSD, after adding
appropriate locale configuration).

Differential Revision: https://reviews.llvm.org/D55746

llvm-svn: 349378
2018-12-17 19:13:41 +00:00
Eric Fiselier 077a0aff16 Unbreak green dragon bots w/o __builtin_launder
llvm-svn: 349373
2018-12-17 18:37:59 +00:00
Eric Fiselier 2d6833c9c9 Expect Clang diagnostics in std::launder test
llvm-svn: 349364
2018-12-17 16:56:24 +00:00
Louis Dionne 04695a7539 [libcxx] Speeding up partition_point/lower_bound/upper_bound
This is a re-application of r345525, which had been reverted by fear of
a regression.

Reviewed as https://reviews.llvm.org/D53994.
Thanks to Denis Yaroshevskiy for the patch.

llvm-svn: 349358
2018-12-17 16:04:39 +00:00
Michal Gorny 4ce222198c [test] [support] Use socket()+bind() to create unix sockets portably
Replace the mknod() call with socket() + bind() for creating unix
sockets.  The mknod() method is not portable and does not work
on NetBSD while binding the socket should work on all systems supporting
unix sockets.

Differential Revision: https://reviews.llvm.org/D55576

llvm-svn: 349305
2018-12-16 15:12:06 +00:00
Michal Gorny 16b9decb93 [test] [ctime] Ignore -Wformat-zero-length warnings
Explicitly disable the -Wformat-zero-length diagnostic when running
ctime tests, since one of the test cases passes zero-length format
string to strftime().  When strftime() is appropriately decorated
with __attribute__(format, ...), this caused the test to fail because
of this warning (e.g. on NetBSD).

Differential Revision: https://reviews.llvm.org/D55661

llvm-svn: 349294
2018-12-16 09:18:31 +00:00
Michal Gorny a25cd0c2da [regex] Use distinct __regex_word on NetBSD
NetBSD defines character classes up to 0x2000.  Use 0x8000 as a safe
__regex_word that hopefully will not collide with other values
in the foreseeable future.

Differential Revision: https://reviews.llvm.org/D55657

llvm-svn: 349293
2018-12-16 09:18:26 +00:00
Eric Fiselier 241c73b191 Fix static assert diagnostic checks in i386
llvm-svn: 349252
2018-12-15 05:18:56 +00:00
Eric Fiselier f707738557 Try 2: Fix bug in buildbot start script
llvm-svn: 349236
2018-12-15 03:48:08 +00:00
Eric Fiselier 6d7331c172 Fix bug in buildbot start script
llvm-svn: 349235
2018-12-15 03:45:21 +00:00
Eric Fiselier 4e903a3a7d Rework docker setup to make it easier to work around bugs on buildbots
llvm-svn: 349234
2018-12-15 03:24:33 +00:00
Eric Fiselier 3e5d847fa0 Tolerate Clangs new static_assert messages
llvm-svn: 349189
2018-12-14 20:42:36 +00:00
Louis Dionne a5e2b081be [libcxx] Mark some tests as still failing on macosx10.14
llvm-svn: 349187
2018-12-14 20:22:44 +00:00
Marshall Clow cac3d118ae When resolving a merge conflict, I put something inside an #ifdef. Fixed.
llvm-svn: 349181
2018-12-14 19:25:22 +00:00
Marshall Clow f60c63c090 Implement P1209 - Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532
llvm-svn: 349178
2018-12-14 18:49:35 +00:00
Louis Dionne bc297b1da9 [libcxx] Make sure use_system_cxx_lib does not override cxx_runtime_root for DYLD_LIBRARY_PATH
Otherwise, even specifying a runtime root different from the library
we're linking against won't work -- the library we're linking against
is always used. This is undesirable if we try testing something like
linking against a recent libc++.dylib but running the tests against an
older version (the back-deployment use case).

llvm-svn: 349171
2018-12-14 18:19:14 +00:00
Eric Fiselier 814715f958 Update google benchmark again
llvm-svn: 349127
2018-12-14 03:48:09 +00:00
Eric Fiselier 7a91ac4753 Update google benchmark version
llvm-svn: 349126
2018-12-14 03:37:13 +00:00
Thomas Anderson 1cffc38485 [libc++] Fix _LIBCPP_EXPORTED_FROM_ABI when visibility annotations are disabled
Fixes a bug where functions would get exported when building with
-fvisibility=hidden and defining _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS. No
visibility annotations should be added in this case.

The new logic for _LIBCPP_EXPORTED_FROM_ABI matches that of the other visibility
annotations around it.

Differential Revision: https://reviews.llvm.org/D55664

llvm-svn: 349080
2018-12-13 20:06:14 +00:00
Louis Dionne 5f1706f3aa [libcxx] Fix pop_back() tests to make sure they don't always just pass
llvm-svn: 349071
2018-12-13 18:53:17 +00:00
Louis Dionne 589f1764fc [libcxx] Add assertion in deque::pop_back when popping from an empty deque
Also, add tests making sure that vector and deque both catch the problem
when assertions are enabled. Otherwise, deque would segfault and vector
would never terminate.

llvm-svn: 348994
2018-12-12 23:58:25 +00:00
Michal Gorny 68cbd6bdb2 [test] [depr.c.headers] XFAIL uchar.h on NetBSD
llvm-svn: 348973
2018-12-12 20:51:46 +00:00
Michal Gorny c22e62d9a7 [test] [filesystems] NetBSD can do symlink permissions too
llvm-svn: 348968
2018-12-12 20:28:52 +00:00
Michal Gorny e8e635ff5e [test] [filesystems] Extend FreeBSD tv_sec==-1 workaround to NetBSD
NetBSD also uses tv_sec==-1 as error status indicator, and does not
support setting such a value.

llvm-svn: 348967
2018-12-12 20:20:15 +00:00
Michal Gorny 97569391ea [test] Permit NetBSD in filesystem_dynamic_test_helper.py
llvm-svn: 348872
2018-12-11 18:29:35 +00:00
Louis Dionne 471b8b73c9 [libcxx] Only enable the availability LIT feature when we're testing libc++
Other standard libraries don't implement availability markup, so it doesn't
make sense to e.g. XFAIL tests based on availability markup outside of
libc++.

llvm-svn: 348871
2018-12-11 18:05:38 +00:00
Louis Dionne 2112fbcc00 [libcxx] Remove the no_default_flags LIT configuration
This is part of an ongoing cleanup of the LIT test suite, where I'm
trying to reduce the number of configuration options. In this case,
the original intent seemed to be running the test suite with libstdc++,
but this is now supported by specifying cxx_stdlib_under_test=libstdc++.

llvm-svn: 348868
2018-12-11 17:29:55 +00:00
Louis Dionne edc36c0731 [NFC] Fix incorrect (but unreachable) LIT error message
It is unreachable because we test that the cxx_stdlib_under_test is
in the supported set of libraries elsewhere. Furthermore, this code
relied on the `use_stdlib_type`, which is never defined.

llvm-svn: 348867
2018-12-11 17:05:20 +00:00
Louis Dionne 17b65c0d58 [libcxx] Fix test failure on GCC 4.9
GCC 4.9 seems to think that a constexpr default constructor implies
the constructor to be noexcept.

llvm-svn: 348850
2018-12-11 15:27:10 +00:00
Louis Dionne 9f77b1a1de [pair] Mark constructors as conditionally noexcept
Summary:
std::tuple marks its constructors as noexcept when the corresponding
memberwise constructors are noexcept too -- this commit improves std::pair
so that it behaves the same.

This is a re-application of r348824, which broke the build in C++03 mode
because a test was marked as supported in C++03 when it shouldn't be.

Note:
I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)`
constructors because those are non-standard extensions, and supporting them
properly is tedious (we have to copy the rvalue-referenceness of the deduced
_Tuple&& onto the result of tuple_element).

<rdar://problem/29537079>

Reviewers: mclow.lists, EricWF

Subscribers: christof, llvm-commits

Differential Revision: https://reviews.llvm.org/D48669

llvm-svn: 348847
2018-12-11 14:22:28 +00:00
Louis Dionne bca37ac8b8 [libcxx] Fix test on compilers that do not support char8_t yet
llvm-svn: 348846
2018-12-11 14:15:54 +00:00
Marshall Clow f17c5f6ba6 Fix problems with char8_t stuff on compilers that don't support char8_t yet
llvm-svn: 348829
2018-12-11 06:06:49 +00:00
Marshall Clow 7dad0bd68b Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308
llvm-svn: 348828
2018-12-11 04:35:44 +00:00
Louis Dionne d5a20703c4 Revert "[pair] Mark constructors as conditionally noexcept"
This broke the tests on Linux. Reverting until I find out why the tests
are broken (tomorrow).

llvm-svn: 348825
2018-12-11 02:32:46 +00:00
Louis Dionne 76cce3b2bd [pair] Mark constructors as conditionally noexcept
Summary:
std::tuple marks its constructors as noexcept when the corresponding
memberwise constructors are noexcept too -- this commit improves std::pair
so that it behaves the same.

Note:
I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)`
constructors because those are non-standard extensions, and supporting them
properly is tedious (we have to copy the rvalue-referenceness of the deduced
_Tuple&& onto the result of tuple_element).

<rdar://problem/29537079>

Reviewers: mclow.lists, EricWF

Subscribers: christof, llvm-commits

Differential Revision: https://reviews.llvm.org/D48669

llvm-svn: 348824
2018-12-11 02:17:23 +00:00
Eric Fiselier 08e231dd9c Add a version of std::function that includes a few optimizations in ABI V2.
Patch by Jordan Soyke (jsoyke@google.com)
Reviewed as D55045

The result of running the benchmarks and comparing them can be found
here: https://gist.github.com/EricWF/a77fd42ec87fc98da8039e26d0349498

llvm-svn: 348812
2018-12-11 00:14:34 +00:00
Eric Fiselier 5f503b47cb Refactor std::function to more easily support alternative implementations.
Patch from Jordan Soyke (jsoyke@google.com)
Reviewed as D55520

This change adds a new internal class, called __value_func, that adds
a minimal subset of value-type semantics to the internal __func interface.

The change is NFC, and is cleanup for the upcoming ABI v2 function implementation (D55045).

llvm-svn: 348778
2018-12-10 18:14:09 +00:00
Marshall Clow 655fb4a767 Update a couple of vector<bool> tests that were testing libc++-specific bahavior. Thanks to Andrey Maksimov for the catch.
llvm-svn: 348660
2018-12-07 22:16:26 +00:00
Louis Dionne 737be83d20 [libcxx] Remove the availability_markup LIT feature
It is now equivalent to the 'availability' LIT feature, so there's no
reason to keep both.

llvm-svn: 348653
2018-12-07 21:48:39 +00:00
Louis Dionne 036a9a0420 [libcxx] Add paranoid cast-to-void in comma operator
llvm-svn: 348611
2018-12-07 16:42:28 +00:00
Louis Dionne 3560fbf304 [libc++] Improve diagnostics for non-const comparators and hashers in associative containers
Summary:
When providing a non-const-callable comparator in a map or set, the
warning diagnostic does not include the point of instantiation of
the container that triggered the warning, which makes it difficult
to track down the problem. This commit improves the diagnostic by
placing it directly in the body of the associative container.

The same change is applied to unordered associative containers, which
had a similar problem.

Finally, this commit cleans up the forward declarations of several
map and unordered_map helpers, which are not needed anymore.

<rdar://problem/41370747>

Reviewers: EricWF, mclow.lists

Subscribers: christof, dexonsmith, llvm-commits

Differential Revision: https://reviews.llvm.org/D48955

llvm-svn: 348529
2018-12-06 21:46:17 +00:00
Louis Dionne 73b9849145 [libcxx] Always convert 'use_system_cxx_lib' to an absolute path
Otherwise, some tests would fail when a relative path was passed,
because they'd use the relative path from a different directory
than the current working directory.

llvm-svn: 348525
2018-12-06 20:09:15 +00:00
Louis Dionne bf3f90c34f [libcxx] Fix incorrect XFAILs for chrono tests on old macos deployment targets
The tests were marked to fail based on the 'availability' LIT feature.
However, those tests should really only be failing when we run them
against the dylibs that were deployed on macosx10.7 and macosx10.8,
which the deployment target has nothing to do with.

This caused the tests to unexpectedly pass when running the tests
with deployment target macosx10.{7,8} but running with a recent dylib.

llvm-svn: 348520
2018-12-06 19:24:20 +00:00
Louis Dionne 7125b08d08 [libcxx] Add checks for unique value of array<T, 0>.begin() and array<T, 0>.end()
The standard section [array.zero] requires the return value of begin()
and end() methods of a zero-sized array to be unique. Eric Fiselier
clarifies: "That unique value cannot be null, and must be properly aligned".
This patch adds checks for the first part of this clarification: unique
value returned by these methods cannot be null.

Reviewed as https://reviews.llvm.org/D55366.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 348509
2018-12-06 18:24:39 +00:00
Louis Dionne 2a23317e69 [libcxx] Add XFAILs for aligned allocation tests on AppleClang 9
Some people are still running the test suite using AppleClang 9.

llvm-svn: 348507
2018-12-06 18:06:47 +00:00
Louis Dionne 26f01c46e9 [libcxx] Make return value of array<T, 0>.data() checked only for libc++
The section array.zero says: "The return value of data() is unspecified".
This patch marks all checks of the array<T, 0>.data() return value as
libc++ specific.

Reviewed as https://reviews.llvm.org/D55364.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 348485
2018-12-06 13:52:20 +00:00
Louis Dionne 2d36473873 [libcxx] Mark some tests as failing on macosx 10.14
llvm-svn: 348437
2018-12-06 00:25:15 +00:00
Louis Dionne f7f5a1f778 [libcxx] Don't depend on availability markup to provide the streams in the dylib
Whether an explicit instantiation declaration should be provided is not
a matter of availability markup.

This problem is exemplified by the fact that some tests were incorrectly
marked as XFAIL when they should instead have been using the definition
of streams from the headers, and hence passing, and that, regardless of
whether visibility annotations are enabled.

llvm-svn: 348436
2018-12-06 00:24:58 +00:00
Louis Dionne f14927e98e [libcxx] Always enable availability in the lit test suite.
Summary:
Running the tests without availability enabled doesn't really make sense:
availability annotations allow catching errors at compile-time instead
of link-time. Running the tests without availability enabled allows
confirming that a test breaks at link-time under some configuration,
but it is more useful to instead check that it should fail at compile-time.

Always enabling availability in the lit test suite will greatly simplify
XFAILs and troubleshooting of failing tests, which is currently a giant
pain because we have these two levels of possible failure: link-time and
compile-time.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Differential Revision: https://reviews.llvm.org/D55079

llvm-svn: 348296
2018-12-04 19:31:08 +00:00
Louis Dionne bb9ca6d0bf [libcxx] Implement P0318: unwrap_ref_decay and unwrap_reference
Summary:
This was voted into C++20 in San Diego. Note that there was a revision
D0318R2 which did include unwrap_reference_t, but we mistakingly voted
P0318R1 into the C++20 Working Draft (which does not include
unwrap_reference_t). This patch implements D0318R2, which is what
we'll end up with in the Working Draft once this mistake has been
fixed.

Reviewers: EricWF, mclow.lists

Subscribers: christof, dexonsmith, libcxx-commits

Differential Revision: https://reviews.llvm.org/D54485

llvm-svn: 348138
2018-12-03 14:03:27 +00:00
Marshall Clow 08794627a3 First part of P0482 - Establish that char8_t is an integral type, and that numeric_limits<char8_t> is valid and sane. (second try)
llvm-svn: 347930
2018-11-29 23:21:18 +00:00
Louis Dionne 9af1d12978 [libcxx] Make UNSUPPORTED for std::async test more fine grained
The test was previously marked as unsupported on all Apple platforms, when
we really just want to mark it as unsupported for previously shipped dylibs
on macosx.

llvm-svn: 347920
2018-11-29 21:25:29 +00:00
Marshall Clow 80fabab677 Revert commit r347904 because it broke older compilers
llvm-svn: 347908
2018-11-29 20:04:47 +00:00
Marshall Clow 8143278500 First part of P0482 - Establish that char8_t is an integral type, and that numeric_limits<char8_t> is valid and sane.
llvm-svn: 347904
2018-11-29 19:49:48 +00:00
Louis Dionne e823b6d7e6 [libcxx] Remove bad_array_length
Summary:
std::bad_array_length was added by n3467, but this never made it into C++.
This commit removes the definition of std::bad_array_length from the headers
AND from the shared library. See the comments in the ABI changelog for details
about the ABI implications of this change.

Reviewers: mclow.lists, dexonsmith, howard.hinnant, EricWF

Subscribers: christof, jkorous, libcxx-commits

Differential Revision: https://reviews.llvm.org/D54804

llvm-svn: 347903
2018-11-29 19:44:57 +00:00
Louis Dionne 8b1f5aae7e [libcxx] More fixes to XFAILs for aligned allocation tests for macosx 10.13
Those tests are a real pain to tweak.

llvm-svn: 347875
2018-11-29 15:52:36 +00:00
Eric Fiselier 9d25ada420 Revert "Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`. "
This reverts commit 087f065cb0c7463f521a62599884493aaee2ea12.

The tests were failing on 32 bit builds, and I don't have time
to clean them up right now. I'll recommit tomorrow with fixed tests.

llvm-svn: 347816
2018-11-28 22:24:19 +00:00
Eric Fiselier 901ede719b Fix bad _LIBCPP_ALIGNOF test
llvm-svn: 347790
2018-11-28 18:32:16 +00:00
Marshall Clow 4d64d7dd64 Implement P0966 - string::reserve should not shrink
llvm-svn: 347789
2018-11-28 18:18:34 +00:00
Eric Fiselier 8a486dac25 Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`.
Summary:
Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See  llvm.org/PR39713

This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used.

This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement.

I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. 

Reviewers: ldionne, EricWF

Reviewed By: EricWF

Subscribers: christof, libcxx-commits

Differential Revision: https://reviews.llvm.org/D54814

llvm-svn: 347787
2018-11-28 18:16:02 +00:00
Louis Dionne 9a494eacba [libcxx] Remove dynarray
Summary:
std::dynarray had been proposed for C++14, but it was pulled out from C++14
and there are no plans to standardize it anymore.

Reviewers: mclow.lists, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, arphaman, libcxx-commits

Differential Revision: https://reviews.llvm.org/D54801

llvm-svn: 347783
2018-11-28 18:02:00 +00:00
Louis Dionne 4eacdb41e9 [libcxx] Use clang-verify in the lit test suite even when availability is enabled
llvm-svn: 347780
2018-11-28 17:31:17 +00:00
Louis Dionne a86710f1e8 [libcxx] Apply _LIBCPP_INLINE_VISIBILITY for std::hash for string_view
llvm-svn: 347765
2018-11-28 15:22:30 +00:00
Louis Dionne 1497359501 [libcxx] Make sure the re-export logic works when paths contain spaces
llvm-svn: 347711
2018-11-27 21:13:31 +00:00
Louis Dionne 3aeeaff89f [libcxx] Fix libc++ re-exporting logic when Command Line Tools are not installed
Summary:
When the Xcode Command Line tools are not installed but CMAKE_OSX_SYSROOT is
set, we would try to re-export symbols from the libc++abi.dylib shipped in
the sysroot, which does not exist. This commit changes the build on OS X to
always re-export symbols from the explicit re-export lists, which doesn't
change depending on what system you're building on, and is therefore much
less flaky.

Reviewers: EricWF, mclow.lists

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

Differential Revision: https://reviews.llvm.org/D54595

llvm-svn: 347708
2018-11-27 20:59:47 +00:00
Marshall Clow 44d247d280 Implement P1085R2 - Should Span be Regular?. This consists entirely of deletions
llvm-svn: 347672
2018-11-27 16:35:41 +00:00
Eric Fiselier e051f98d09 Remove duplicate _LIBCPP_INLINE_VISIBILITY attributes.
This attribute should appear only on the first declaration. This
patch cleans up <string> by removing the attribute on redeclarations.

llvm-svn: 347608
2018-11-26 22:51:35 +00:00
Eric Fiselier 01a87ef88b Add basic_string::__resize_default_init (from P1072)
This patch adds an implementation of __resize_default_init as
described in P1072R2. Additionally, it uses it in filesystem to
demonstrate its intended utility.

Once P1072 lands, or if it changes it's interface, I will adjust
the internal libc++ implementation to match.

llvm-svn: 347589
2018-11-26 20:15:38 +00:00
Louis Dionne 94104b1b6b [libcxx] Fix XFAILs for aligned allocation tests
In r339743, I marked several aligned allocation tests as downright
unsupported on macosx in an attempt to unbreak the build. It turns
out that marking them as unuspported whenever we're on OS X is way
too coarse grained. This commit marks the tests as XFAIL with more
granularity.

llvm-svn: 347585
2018-11-26 19:30:08 +00:00
Louis Dionne 7ae4f5c6de [libcxx] Fix XFAIL for aligned deallocation test with trunk Clang
The test was marked as failing whenever the deployment target was 10.12
or older, but in reality the test passes when the deployment target is
10.12 on recent Clangs. This happens because only older clangs do not
honor the -faligned-allocation flag, which disables any availability
error related to aligned allocation support, regardless of the
deployment target.

llvm-svn: 347580
2018-11-26 17:47:16 +00:00
Louis Dionne 20883fc20f [libcxx] Use a type that is always an aggregate in variant's tests
Summary:
In PR39232, we noticed that some variant tests started failing in C++2a mode
with recent Clangs, because the rules for literal types changed in C++2a. As
a result, a temporary fix was checked in (enabling the test only in C++17).

This commit is what I believe should be the long term fix: I removed the
tests that checked constexpr default-constructibility with a weird type
from the tests for index() and valueless_by_exception(), and instead I
added tests for those using an obviously literal type in the test for the
default constructor.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, arphaman, libcxx-commits, rsmith

Differential Revision: https://reviews.llvm.org/D54767

llvm-svn: 347568
2018-11-26 16:14:56 +00:00
Louis Dionne 2d91d2a388 [NFC] Fix typo in comment
llvm-svn: 347477
2018-11-22 19:10:28 +00:00
Louis Dionne 3ffe0b75fb [libcxx] Reintroduce UNSUPPORTED annotation for strstreambuf overflow test
This is a revert of r347421, except I'm using the with_system_cxx_lib
lit feature instead of availability to mark the test as unsupported
(because the problem is a bug in the dylib itself). In r347421, I said
I wasn't able to reproduce the issue and that's why I was removing it:
this was because I ran lit slightly wrong. The problem mentioned really
exists.

llvm-svn: 347475
2018-11-22 17:43:22 +00:00
Louis Dionne 5b2605edc4 [libcxx] Add XFAIL for test on OS X 10.12 to 10.14
llvm-svn: 347473
2018-11-22 16:38:03 +00:00
Louis Dionne 893413318f [NFC][libcxx] Print human-friendly command line when lit test fails
We used to print a Python list corresponding to the command. It is more
useful to print the joined string so it can be copy/pasted directly when
a test fails.

llvm-svn: 347471
2018-11-22 16:10:49 +00:00
Louis Dionne 509f7d7c30 [libcxx] Remove incorrect XFAIL on macos 10.12
llvm-svn: 347461
2018-11-22 13:40:56 +00:00
Louis Dionne bb4f2dfc36 [libcxx] Improve error message when an invalid directory is provided as use_system_cxx_lib
llvm-svn: 347435
2018-11-21 23:00:45 +00:00
Louis Dionne 2804508ffe [libcxx] Remove unused definition of aligned allocation macro on old OS X
We don't support mac OS 10.6 and older anymore, so this macro can never
be defined. This bit of code had been added in D28931 as a fix for
PR31448, but it doesn't seem necessary anymore.

llvm-svn: 347427
2018-11-21 21:22:08 +00:00
Louis Dionne 91614db033 [libcxx] Fix incorrect iterator type in vector container test
The iterator types for different specializations of containers with the
same element type but different allocators are not required to be
convertible. This patch makes the test to take the iterator type from
the same container specialization as the created container.

Reviewed as https://reviews.llvm.org/D54806.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 347423
2018-11-21 20:53:07 +00:00
Louis Dionne 94d4c9e094 [libcxx] Mark strstreams tests as being supported on all OS X versions
I wasn't able to reproduce the issue referred to by the comment using
the libc++'s shipped with mac OS X 10.7 and 10.8, so I assume this may
have been fixed in a function that is now shipped in the headers. In
that case, the tests will pass no matter what dylib we're using.

In the worst case, some test bots will start failing and I'll understand
why I was wrong, and I can create an actual lit feature for it. Note
that I could just leave this test alone, but this change is on the path
towards eradicating vendor-specific availability markup from the test
suite.

llvm-svn: 347421
2018-11-21 20:47:00 +00:00
Eric Fiselier 74fb163184 Fix missing includes in test header
llvm-svn: 347416
2018-11-21 20:39:24 +00:00
Louis Dionne 53922b7dd1 [libcxx] Make sure operator+ is declared with the right visibility attribute
Otherwise, Clang complains about internal_linkage not being applied to the
first declaration of the operator (and rightfully so).

llvm-svn: 347400
2018-11-21 17:31:55 +00:00
Louis Dionne 352adb6532 [libcxx] Mark stray symbols as hidden to try and fix the build
r347395 changed the ABI list on Linux, but two of those symbols are still
being exported from the shared object:

    _ZSt18make_exception_ptrINSt3__112future_errorEESt13exception_ptrT_
    _ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EERKS9_PKS6_

This commit makes sure those symbols are not exported, as they should be.

llvm-svn: 347399
2018-11-21 17:00:52 +00:00
Louis Dionne 2359864be2 [NFC][libcxx] Add revision number to ABI changelog
llvm-svn: 347396
2018-11-21 16:27:14 +00:00
Louis Dionne 835140a427 [libcxx] Make sure we can build with -fvisibility=hidden on Linux
Summary:
This commit marks a few functions as hidden and removes them from the ABI list
on Linux such that libc++ can be built with -fvisibility=hidden. The functions
marked as hidden by this patch were exported from the shared object only
because they were implicitly instantiated function templates. It is safe
to stop exporting those symbols from the shared object because nobody could
actually depend on them: implicit instantiations are not taken from shared
objects.

The symbols removed in this commit are basically the same that had been
removed in https://reviews.llvm.org/D53868, but that patch had to be reverted
because it broke the build (because the functions were not marked as hidden
like this patch does).

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Differential Revision: https://reviews.llvm.org/D54639

llvm-svn: 347395
2018-11-21 16:24:46 +00:00
Zhihao Yuan 147b25b4a1 [libc++] Implement P0487R1 - Fixing operator>>(basic_istream&, CharT*)
Summary:
Avoid buffer overflow by replacing the pointer interface with an array reference interface in C++2a.
Tentatively ready on Batavia2018.

 https://wg21.link/lwg2499
 https://wg21.link/p0487

Reviewers: mclow.lists, ldionne, EricWF

Reviewed By: ldionne

Subscribers: libcxx-commits, cfe-commits, christof

Differential Revision: https://reviews.llvm.org/D51268

llvm-svn: 347377
2018-11-21 03:30:10 +00:00
Louis Dionne 52118fcb46 [NFC] Rename lit feature to '-fsized-deallocation' for consistency
The '-faligned-allocation' flag uses a feature with the same name (with a
leading dash).

llvm-svn: 347367
2018-11-21 00:03:17 +00:00
Louis Dionne 8eb65cb25e [NFC] Reformat availability #defines in __config
Aligning everything makes what we're doing more obvious.

llvm-svn: 347363
2018-11-20 23:18:25 +00:00
Louis Dionne 2e5f0c4e16 [NFC] Fix formatting in availability documentation
llvm-svn: 347362
2018-11-20 23:07:01 +00:00
Marshall Clow 289f1ce53e A couple of tests were broken when clang implemented the compiler parts of P0482 (support for char8_t). Comment out those bits until we implement the corresponding bits in libc++
llvm-svn: 347360
2018-11-20 22:55:40 +00:00
Louis Dionne c2b375ad60 [libcxx] Fix threads detection on GNU/Hurd
GNU/Hurd provides standard Posix threads

Reviewed as https://reviews.llvm.org/D54339.
Thanks to Samuel Thibault for the patch.

llvm-svn: 347347
2018-11-20 21:14:05 +00:00
Marshall Clow 422c4295c3 Note that P0899R1 requires no work.
llvm-svn: 347344
2018-11-20 20:38:15 +00:00
Marshall Clow 859bf40761 Mark P0771 as complete; we already did this - I just added tests to be sure
llvm-svn: 347343
2018-11-20 20:37:07 +00:00
Samuel Benzaquen 06a9b5a305 Add benchmarks for sorting and heap functions.
Summary:
Benchmarks for std::sort, std::stable_sort, std::make_heap,
std::sort_heap, std::pop_heap and std::push_heap.

The benchmarks are run with integers and strings, and with different
sorted input.

Reviewers: EricWF

Subscribers: christof, mgrang, ldionne, libcxx-commits

Differential Revision: https://reviews.llvm.org/D53978

llvm-svn: 347329
2018-11-20 17:15:17 +00:00
Louis Dionne cc870190d8 [NFC][libcxx] Fix incorrect comments
llvm-svn: 347267
2018-11-19 22:06:42 +00:00
Louis Dionne 70c4858892 [libcxx] Fix XFAIL for GCC 4.9
The XFAIL started passing since we're only testing for trivial-copyability of
reference_wrapper in C++14 and above. This commit constrains the XFAIL to
gcc-4.9 with C++14 (it would also fail on C++17 and above, but those standards
are not available with GCC 4.9).

llvm-svn: 347264
2018-11-19 20:53:38 +00:00
Louis Dionne e0ac069286 [libcxx] Update test of trivial copyability of reference_wrapper
N4151 is not an extension anymore, it was standardized in C++14.

llvm-svn: 347263
2018-11-19 20:21:45 +00:00
Eric Fiselier 9c97ca1b99 Add docker configurations used by the buildbots.
These are the scripts I use to create the docker images for
the build bots and run them.

llvm-svn: 347244
2018-11-19 18:43:31 +00:00
Louis Dionne 85efcbe449 [libcxx] Fix incorrect #include for std::hash
Reviewed as https://reviews.llvm.org/D54705.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 347233
2018-11-19 17:40:16 +00:00
Louis Dionne c019b30ac2 [libcxx] Add missing <cstddef> includes in tests
Some tests use type std::max_align_t, but don't include <cstddef> header
directly. As a result, these tests won't compile against some conformant
libraries.

Reviewed as https://reviews.llvm.org/D54645.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 347232
2018-11-19 17:39:50 +00:00
Louis Dionne 8a063df194 [libcxx] Add availability markup for bad_optional_access, bad_variant_access and bad_any_cast
Reviewers: dexonsmith, EricWF

Subscribers: christof, arphaman, libcxx-commits

Differential Revision: https://reviews.llvm.org/D53256

llvm-svn: 347219
2018-11-19 15:37:04 +00:00
Louis Dionne 2fcdcac4ec [libcxx] Add missing includes in tests
A bunch of unordered containers tests call library functions but don't directly
include the corresponding header files:

- fabs() (defined in <cmath> which is not included);
- is_permutation() (defined in <algorithm> which is not included);
- next() (defined in <iterator> which is not included).
- As a result, these tests won't compile against some conformant libraries.

Reviewed as https://reviews.llvm.org/D54643.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 347085
2018-11-16 19:52:47 +00:00
Louis Dionne 91c0a462d8 [libcxx] Mention restriction on inline namespaces in LIBCXX_ABI_NAMESPACE docs
I also kept the original "vague" documentation that saying that users are
responsible for not breaking us. This doesn't mean anything because there's
no way they can actually enforce that unless we restrict ourselves to a
specific naming scheme, but I left the documentation because it acts as a
good warning and gives us more leeway.

llvm-svn: 347052
2018-11-16 14:57:47 +00:00
Benjamin Kramer 9dfe32e41c Remove BUILD file from google-benchmark
This was removed in r336666, but accidentally re-added in r346984.

llvm-svn: 347046
2018-11-16 12:53:17 +00:00
Eric Fiselier aacebba5e6 Disable filesystem benchmark when libstdc++ doesn't support it
llvm-svn: 346989
2018-11-15 19:53:43 +00:00
Eric Fiselier 782a15a0d1 Upgrade Google Benchmark library to ToT
llvm-svn: 346984
2018-11-15 19:22:53 +00:00
Eric Fiselier 0997403a22 propagate __config_site includes when building benchmarks
llvm-svn: 346933
2018-11-15 07:29:56 +00:00
Eric Fiselier ae533d31af Work around C++03 decltype limitations
llvm-svn: 346917
2018-11-15 00:27:06 +00:00
Eric Fiselier 22bdb33108 Get tests compiling with -Wunused-local-typedef
llvm-svn: 346914
2018-11-15 00:11:02 +00:00
Stephan T. Lavavej 1b19549b13 [libcxx] [test] Fix Clang -Wunused-local-typedef warnings.
C++11's [hash.requirements] never required these typedefs from users.

llvm-svn: 346912
2018-11-14 23:23:55 +00:00
Stephan T. Lavavej 174072c1d2 [libcxx] [test] Include <cassert> for assert().
This fixes compiler errors with MSVC's STL.

llvm-svn: 346911
2018-11-14 23:23:51 +00:00
Stephan T. Lavavej 21981194eb [libcxx] [test] Fix MSVC warning C4800.
This was implicitly converting [1, 3] to bool, which triggers
an MSVC warning. The test should just pass `true`, which is
simpler, has the same behavior, and avoids the warning. (This
is a library test, not a compiler test, and the conversion happens
before calling `push_back`, so passing [1, 3] isn't interesting
in any way. This resembles a previous change to stop passing
`1 == 1` in the `vector<bool>` tests.)

llvm-svn: 346910
2018-11-14 23:23:46 +00:00
Eric Fiselier 5828115e58 Attempt to show progress bar in benchmark tests
llvm-svn: 346905
2018-11-14 22:49:42 +00:00
Eric Fiselier 1dbe7ec946 Exclude check-cxx-benchmarks from the global test target.
llvm-svn: 346904
2018-11-14 22:48:43 +00:00
Eric Fiselier 336a1a6811 Rename cxx-benchmark-unittests target and convert to LIT.
This patch renames the cxx-benchmark-unittests to check-cxx-benchmarks
and converts the target to use LIT in order to make the tests run faster
and provide better output.

In particular this runs each benchmark in a suite one by one, allowing
more parallelism while ensuring output isn't garbage with multiple threads.

Additionally, it adds the CMake flag '-DLIBCXX_BENCHMARK_TEST_ARGS=<list>'
to specify what options are passed when running the benchmarks.

llvm-svn: 346888
2018-11-14 20:38:46 +00:00
Alexander Richardson f0b757e231 [libcxx] [test] Fix running tests on macOS with python3
Summary:
The result of subprocess.check_output() is bytes in python3 which we need
to convert to str(). Simplify this by using the executeCommand() helper.

Reviewers: ldionne, EricWF

Reviewed By: ldionne

Subscribers: christof, libcxx-commits

Differential Revision: https://reviews.llvm.org/D54522

llvm-svn: 346878
2018-11-14 17:58:55 +00:00
Stephan T. Lavavej dec8905e13 [libcxx] [test] Strip trailing whitespace. NFC.
llvm-svn: 346826
2018-11-14 03:06:06 +00:00
Petr Hosek 2d2e23e89b [CMake] Passthrough CFLAGS when checking the compiler-rt path
This is needed when cross-compiling for a different target since
CFLAGS may contain additional flags like -resource-dir which
change the location in which compiler-rt builtins are found.

Differential Revision: https://reviews.llvm.org/D54371

llvm-svn: 346820
2018-11-14 00:09:26 +00:00
Eric Fiselier 02f8e7c355 Add cxx-benchmark-unittests target
This patch adds the cxx-benchmark-unittests target so we can start
getting test coverage on the benchmarks, including building with
sanitizers. Because we're only looking for test-coverage, the benchmarks
run for the shortest time possible, and in parallel.

The target is excluded from all by default. It only
builds and runs the libcxx configurations of the benchmarks, and not
any versions built against the systems native standard library.

llvm-svn: 346811
2018-11-13 23:08:31 +00:00
Eric Fiselier 9039b6012e Fix "use of" uninitialized memory in benchmark.
An argument to DoNotOptimize was not fully initialized, which caused
msan to complain.

llvm-svn: 346808
2018-11-13 23:00:55 +00:00
Marshall Clow f54aeed6f4 Mark #2184 as complete; the tests are fine. (I thought that they were wrong before)
llvm-svn: 346805
2018-11-13 22:26:03 +00:00
Louis Dionne c2078fb1c8 [NFC] Mark LWG3128 and LWG3132 as requiring no work
Those LWG issues were adopted in San Diego and require no work
on our side.

llvm-svn: 346799
2018-11-13 21:13:10 +00:00
Eric Fiselier 3bea50aeb3 Fix UB in string.bench.cpp.
The usage of aligned_storage failed to pass the alignment it wanted,
which caused it to have a larger size and alignment that the
std::string's it was intended to store.

This patch manually specifies the alignment, as well as cleaning up
type alias bugs.

llvm-svn: 346779
2018-11-13 19:16:19 +00:00
Marshall Clow 78d8b5e1cf Remove duplicate entry for issue 3134
llvm-svn: 346772
2018-11-13 18:07:51 +00:00
Marshall Clow 04fc84408b Update status for issue 3122
llvm-svn: 346771
2018-11-13 18:05:10 +00:00
Louis Dionne 77c17e26ea [NFC][libcxx] Mark P1006R1 as complete
llvm-svn: 346767
2018-11-13 17:33:11 +00:00
Marshall Clow cf355fc373 Implement P0972R0: <chrono> zero(), min(), and max() should be noexcept. Reviewed as https://reviews.llvm.org/D53828
llvm-svn: 346766
2018-11-13 17:22:41 +00:00
Louis Dionne 7a83c5f623 [NFC][libcxx] Mark P1006 as implemented in LLVM 8.0
It was implemented in https://reviews.llvm.org/D53867

llvm-svn: 346765
2018-11-13 17:09:25 +00:00
Louis Dionne 7272026993 [libcxx] Implement http://wg21.link/p1006, constexpr in pointer_traits
Summary:
P1006 adds support for constexpr in the specialization of pointer_traits
for raw pointers. This is necessary in order to use pointer_traits in
the upcoming constexpr containers. We expect P1006 to be voted into the
working draft for C++20 at the San Diego meeting.

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, libcxx-commits

Differential Revision: https://reviews.llvm.org/D53867

llvm-svn: 346764
2018-11-13 17:04:05 +00:00
Louis Dionne c9c6212f6f [libcxx] GNU/Hurd uses BSD-based interfaces, but does not (and won't) provide <sys/sysctl.h>
Reviewed as https://reviews.llvm.org/D54338.

Thanks to sthibaul for the patch.

llvm-svn: 346763
2018-11-13 17:00:04 +00:00
Eric Fiselier 4de1c753ff Attempt to make benchmarks fall back to -std=c++1z when C++17 isn't supported.
The benchmarks currently require C++17, however Clang 3.9 doesn't
support -std=c++17 while still supporting all the C++17 features needed
to compile the benchmarks.

This patch makes the benchmark build attempt to fall back to -std=c++1z
when -std=c++17 isn't supported.

See llvm.org/PR39629

llvm-svn: 346744
2018-11-13 07:03:16 +00:00
Eric Fiselier 32869c6997 Add emplace tests for multiset/unordered_multiset.
This patch adds tests to ensure that multiset/unordered_multiset's emplace
method correctly constructs the elements without any intervening
constructions.

llvm-svn: 346743
2018-11-13 06:30:36 +00:00
Marshall Clow d4fa0381e3 Fix PR39619 - iterator_traits isn't SFINAE-friendly enough. Thanks to Eric for the report
llvm-svn: 346738
2018-11-13 05:33:31 +00:00
Marshall Clow a87fe7a345 Update to-do list with new work from WG21 meeting in San Diego
llvm-svn: 346634
2018-11-12 04:58:00 +00:00
Louis Dionne cdaf2b8dce [NFC] Reformat std::optional tests
llvm-svn: 346630
2018-11-12 01:38:30 +00:00
Louis Dionne d9247890da [NFC] Fix typo in <tuple>
llvm-svn: 346629
2018-11-12 01:28:07 +00:00
Petr Hosek f30c0117c8 [libcxx] Provide thread annotations for shared_mutex
shared_mutex was introduced in C++17 but its implementation currently
doesn't use Clang's thread annotations like regular mutex. This change
adds those.

Differential Revision: https://reviews.llvm.org/D54290

llvm-svn: 346567
2018-11-09 23:32:25 +00:00
Eric Fiselier b50daf7a21 Attempt to enable -Wconversion
llvm-svn: 346451
2018-11-08 23:57:32 +00:00
Fangrui Song 892bbd3f88 Fix -Wimplicit-fallthrough warning
Reviewers: EricWF, ldionne, mclow.lists

Reviewed By: ldionne

Subscribers: christof, libcxx-commits

Differential Revision: https://reviews.llvm.org/D54234

llvm-svn: 346369
2018-11-07 23:51:13 +00:00
Marshall Clow 89176c72e7 Fix the test for partition_copy so it is not ridiculously slow. Also, detab.
llvm-svn: 346104
2018-11-04 17:57:25 +00:00