Commit Graph

5566 Commits

Author SHA1 Message Date
Louis Dionne 3b8c90b80d [libc++] (Take 2) Correctly handle Objective-C++ ARC qualifiers in std::is_pointer
Summary:
Otherwise, std::is_pointer<id __strong> works, but std::is_pointer<id __weak>
(and others) don't work as expected.

The previous patch (r357517) had to be reverted in r357569 because it
broke the Chromium build. This patch shouldn't have the same problem.

rdar://problem/49126333

Reviewers: ahatanak, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 357586
2019-04-03 14:29:52 +00:00
Hans Wennborg e475c89700 Revert "[libc++] Correctly handle Objective-C++ ARC qualifiers in std::is_pointer"
This broke the Chromium build on Mac, see https://crbug.com/949071

> Summary:
> Otherwise, std::is_pointer<id __strong> works, but std::is_pointer<id __weak>
> (and others) don't work as expected.
>
> rdar://problem/49126333
>
> Reviewers: ahatanak, EricWF
>
> Subscribers: christof, jkorous, dexonsmith, libcxx-commits
>
> Differential Revision: https://reviews.llvm.org/D60087

llvm-svn: 357569
2019-04-03 10:07:37 +00:00
Petr Hosek 30d9af1b24 [CMake] Differentiate between static and shared libc++abi
This addresses the issue introduced in r354212 which broke the case when
static libc++abi is merged into static libc++, but shared libc++ is
linked against shared libc++. There are 4 different possible
combinations which is difficult to capture using a single variable. This
change splits LIBCXX_CXX_ABI_LIBRARY into two:
LIBCXX_CXX_SHARED_ABI_LIBRARY and LIBCXX_CXX_STATIC_ABI_LIBRARY to
handle the shared and static cases. This in turn allows simplification
of some of the logic around merging of static archives.

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

llvm-svn: 357556
2019-04-03 01:33:14 +00:00
Billy Robert O'Neal III 4c1581e2da [libcxx] [test] Add missing <stdexcept> to name std::out_of_range to string.conversions\stold.pass.cpp.
llvm-svn: 357547
2019-04-03 00:08:42 +00:00
Billy Robert O'Neal III 2bb0f75a80 [libcxx] [test] Use ptrdiff_t rather than int in splice_after_range.pass.cpp to avoid narrowing from pointer subtraction to int warnings.
Reviewed as https://reviews.llvm.org/D60104

llvm-svn: 357546
2019-04-03 00:07:18 +00:00
Billy Robert O'Neal III 7b9e4ebb03 [libcxx] [test] Fix test bugs in string.cons/copy_alloc.pass.cpp.
Fixed the inability to properly rebind the testing allocator, by making the
inner alloc_impl type a plain struct and making the operations templates. Before
rebind failed to compile complaining that a alloc_impl<T>* was not convertible
to an alloc_impl<U>*.

This enables the test to pass for MSVC++ once we provide the strong guarantee
for the copy assignment operator.

Reviewed as https://reviews.llvm.org/D60023

llvm-svn: 357545
2019-04-03 00:05:49 +00:00
Marshall Clow 0583d9ea8d Fix backwards test that I committed yesterday. Sigh
llvm-svn: 357540
2019-04-03 00:01:03 +00:00
Louis Dionne 38b7e74836 Revert "[libc++] Fix error flags and exceptions propagated from input stream operations"
This reverts commits r357533 and r357531, which broke the LLDB
data formatters. I'll hold off until we know how to fix the data
formatters accordingly.

llvm-svn: 357536
2019-04-02 22:21:27 +00:00
Louis Dionne 00f6cfe908 [libc++] Fix build when exceptions are turned off
llvm-svn: 357533
2019-04-02 22:02:17 +00:00
Louis Dionne 1754774369 [libc++] Fix error flags and exceptions propagated from input stream operations
Summary:
Before this patch, we would only ever throw an exception if the badbit
was set on the stream. The Standard is currently very unclear on how
exceptions should be propagated and what error flags should be set by
the input stream operations. This commit changes libc++ to behave under
a different (but valid) interpretation of the Standard. This interpretation
of the Standard matches what other implementations are doing.

I will submit a paper in San Diego to clarify the Standard such that the
interpretation used in this commit (and other implementations) is the only
possible one.

PR21586
PR15949
rdar://problem/15347558

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, cfe-commits

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

llvm-svn: 357531
2019-04-02 21:43:07 +00:00
Louis Dionne aac9285377 [libc++] Correctly handle Objective-C++ ARC qualifiers in std::is_pointer
Summary:
Otherwise, std::is_pointer<id __strong> works, but std::is_pointer<id __weak>
(and others) don't work as expected.

rdar://problem/49126333

Reviewers: ahatanak, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 357517
2019-04-02 19:48:39 +00:00
Louis Dionne 6cd8126360 [libc++] Remove use of auto with actual type
For compatibility with C++03.

llvm-svn: 357512
2019-04-02 19:20:47 +00:00
Louis Dionne f401a749e1 [libc++][NFC] Remove useless public: label at the end of class
llvm-svn: 357511
2019-04-02 19:11:22 +00:00
Marshall Clow 3bf63cf3b3 Special case some duration arithmetic for GCC and PPC because their long double constant folding is broken. Fixes PR#39696.
llvm-svn: 357478
2019-04-02 14:46:36 +00:00
Marshall Clow 68ad5c34e0 Fix typo that I introduced in r357413. Thanks to ensadc@mailnesia.com for the catch.
llvm-svn: 357474
2019-04-02 14:00:36 +00:00
Eric Fiselier 0657197588 Fix a number of bugs in __val_expr's subset operator[].
The current definitions were entirely broken. They didn't call any
existing constructor and the forgot to friend the expression types they
were trying to construct.

llvm-svn: 357453
2019-04-02 08:05:23 +00:00
Louis Dionne beb6efb42e [libcxx] Make sure reference_wrapper works with incomplete types
Summary: Completes P0357R3, which was merged into the C++20 Working Draft in San Diego.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 357423
2019-04-01 19:53:44 +00:00
Marshall Clow ecad92b068 Fix PR#41323 'Race condition in steady_clock::now for _LIBCPP_WIN32API'. thanks to Ivan Afanasyev for the report.
llvm-svn: 357413
2019-04-01 17:23:30 +00:00
Louis Dionne 2b0c7abba3 [libc++] Declare std::tuple_element as struct instead of class
Similarly to https://reviews.llvm.org/rL350972, this revision changes
std::tuple_element from class to struct.

Fixes PR41331.
Thanks to Jan Wilken Dörrie for the patch.

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

llvm-svn: 357411
2019-04-01 16:39:34 +00:00
Marshall Clow efa6d803c6 Fix PR41130 - 'operator/ of std::chrono::duration and custom type'. Thanks to Zulan for the report, and Howard for the direction of the fix.
llvm-svn: 357410
2019-04-01 16:38:02 +00:00
Eric Fiselier b0e79823d6 Make common_type's implementation common
Summary:
Currently the C++03 implementation of common_type has much different behavior than the C++11 one. This causes bugs, including inside `<chrono>`.

This patch unifies the two implementations as best it can. The more code they share, the less their behavior can diverge. 

Reviewers: mclow.lists, ldionne, sbenza

Reviewed By: mclow.lists, ldionne

Subscribers: libcxx-commits

Tags: #libc

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

llvm-svn: 357370
2019-03-31 20:49:06 +00:00
Eric Fiselier 0706e144d5 Mark fenv.h as a system header before the #include_next directive
This fixes a -Wgnu-include-next warning

Patch by dmauro.

llvm-svn: 357267
2019-03-29 16:03:57 +00:00
Marshall Clow 1931c4306a Fix PR#35967: '<regex> syntax_option_type is not a proper bitmask' Sadly, this is an ABI break, so it's only available if you define either '_LIBCPP_ABI_VERSION > 2' or '_LIBCPP_ABI_UNSTABLE' or '_LIBCPP_ABI_REGEX_CONSTANTS_NONZERO' and rebuild your dylib.
llvm-svn: 357190
2019-03-28 17:30:23 +00:00
Louis Dionne afeff20c0f [libc++] Remove unnecessary <iostream> #includes in tests
Some tests #include <iostream> but they don't use anything from the
header. Those are probably artifacts of when the tests were developped.

llvm-svn: 357181
2019-03-28 16:38:15 +00:00
Marshall Clow 24fa56bcc8 Reworked all the utilities/meta tests to use ASSERT_SAME_TYPE instead of 'static_assert( is_same<'. Much easier to read. I left two tests alone: is_same.pass.cpp, which should call 'is_same' directly, and common_type.pass.cpp, which Eric is working on. NFC intended
llvm-svn: 357146
2019-03-28 03:39:25 +00:00
Louis Dionne 7cd0dad834 [libc++] Rename span's as_writeable_bytes to as_writable_bytes
Summary: The Standard says as_writable_bytes.

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 357139
2019-03-28 01:27:52 +00:00
Thomas Anderson 24812d8ac4 Fix and speedup __libcpp_locale_guard on Windows
The old implementation assumed the POSIX `setlocale()` API where the old
locale is returned.  On Windows, the _new_ locale is returned.  This meant
that `__libcpp_locale_guard` wasn't resetting the locale on destruction.

The new implementation fixes the above issue and takes advantage of
`setlocale(LC_ALL)` to reduce the number of calls, and also avoids setting
the locale at all if it's not necessary.

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

llvm-svn: 357104
2019-03-27 18:09:30 +00:00
Casey Carter 132955fa66 Fix occurrences of _LIBCPP_ASSERT in span tests
llvm-svn: 357092
2019-03-27 17:03:44 +00:00
Louis Dionne daf43ed800 [libc++] Add proper XFAILs for shared_mutex tests
Dylib support for shared_mutex was added in macOS 10.12, so the tests
should be XFAILed accordingly instead of being completely disabled
whenever availability is enabled.

rdar://problem/48769104

llvm-svn: 357079
2019-03-27 15:50:34 +00:00
Thomas Anderson d4d824a861 [libc++] Fix return value of snprintf_l() on Windows when buffer is too small
When the output buffer is too small to contain the output, `vsnprintf()`
fills the buffer and returns the number of characters that __would have__
been written if the buffer was sufficiently large.

`_vnsprintf_s()` on the other hand fills the buffer and returns -1 when this
happens.  We want the former behavior, but we also want to be able to
pass in a locale to prevent having to call `setlocale()`.

`__stdio_common_vsprintf()` is the only function general enough to get
the behavior we want.

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

llvm-svn: 357024
2019-03-26 19:51:30 +00:00
Brian Gesiak b66754a29e Revert "[coroutines] Add std::experimental::task<T> type"
This revision is causing build and test failures, such as
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-armv8-linux/builds/648/steps/test.libcxx/logs/stdio,
so I'll revert it.

llvm-svn: 357023
2019-03-26 19:50:46 +00:00
Brian Gesiak 57839425aa [coroutines] Add std::experimental::task<T> type
Summary:
Adds the coroutine `std::experimental::task<T>` type described in proposal P1056R0.
See https://wg21.link/P1056R0.

This implementation allows customization of the allocator used to allocate the
coroutine frame by passing std::allocator_arg as the first argument, followed by
the allocator to use.

This supports co_awaiting the same task multiple times. The second and
subsequent times it returns a reference to the already-computed value.

This diff also adds some implementations of other utilities that have potential for
standardization as helpers within the test/... area:
- `sync_wait(awaitable)` - See P1171R0
- `manual_reset_event`

Move the definition of the __aligned_allocation_size helper function
from <experimental/memory_resource> to <experimental/__memory>
so it can be more widely used without pulling in memory_resource.

Outstanding work:
- Use C++14 keywords directly rather than macro versions
  eg. use `noexcept` instead of `_NOEXCEPT`).
- Add support for overaligned coroutine frames.
  This may need wording in the Coroutines TS to support passing the extra `std::align_val_t`.
- Eliminate use of `if constexpr` if we want it to compile under C++14.

Patch by @lewissbaker (Lewis Baker).

llvm-svn: 357010
2019-03-26 17:46:06 +00:00
Marshall Clow 36db489874 Cleaup of requirements for optional. While researching LWG3196, I realized that optional did not reject 'const in_place_t' like it should. Added a test as well, and a check for arrays (which were already disallowed, but now we get a better error message). Should not affect anyone's code.
llvm-svn: 356918
2019-03-25 16:35:59 +00:00
Louis Dionne 976073794e [libc++][CMake] Allow merging libc++abi.a into libc++ even on Apple platforms
Summary:
I can't see a good reason to disallow this, even though it isn't the
standard way we build libc++ for Apple platforms.

Making this work on Apple platforms requires using different flags for
--whole-archive and removing the -D flag when running `ar` to merge
archives because that flag isn't supported by the `ar` shipped on Apple
platforms. This shouldn't be an issue since the -D option appears to be
enabled by default in GNU `ar`.

Reviewers: phosek, EricWF, serge-sans-paille

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

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

llvm-svn: 356903
2019-03-25 14:56:29 +00:00
Marshall Clow e1cd11d80f Fix a minor bug with std::next and prev not and negative numbers. In particular, std::prev cannot require Bidirectional Iterators, because you might 'go back' -1 places, which goes forward. Thanks to Ville and Jonathan for the bug report.
llvm-svn: 356818
2019-03-22 22:32:20 +00:00
Louis Dionne c48e223309 [libc++] Update the list of symbols exported from libc++abi for new/delete
When libc++ does not provide new/delete, libc++abi now also provides the
aligned allocation and deallocation functions, so those should be part of
the re-export list for libc++.

llvm-svn: 356804
2019-03-22 20:18:17 +00:00
Louis Dionne 5934341fd9 [libc++] Re-export the sjlj ABI v2 for ARM architectures
We were previously not exporting the right ABI version of libc++abi.

llvm-svn: 356798
2019-03-22 19:38:53 +00:00
Marshall Clow a73ac7d932 Fix a vector test to not use a local type as a template parameter. This causes a warning on C++03. NFC
llvm-svn: 356726
2019-03-22 00:49:41 +00:00
Louis Dionne bea1817e41 [libc++] Remove too-stringent XFAILs for file_clock tests
Those tests actually pass because we don't use anything that's marked
as unavailable.

llvm-svn: 356719
2019-03-21 21:07:33 +00:00
Louis Dionne f0d7d87a47 [NFC][libc++] Reindent #ifdefs
I don't understand why we don't always do that. We do it for normal `if`s
in the code, but not for preprocessor `if`s? It's a lot more readable when
indented properly.

llvm-svn: 356693
2019-03-21 18:19:21 +00:00
Louis Dionne 952387251e [libc++] Re-document how to use <filesystem> with various versions of libc++
This documentation was removed when we added <filesystem> to the dylib
in r356518, but it really should have been updated to reflect the new
state of things. Keeping documentation around doesn't hurt and users
will have an easier time migrating.

llvm-svn: 356681
2019-03-21 16:21:09 +00:00
Samuel Benzaquen 9b7aa02b53 Add relational benchmark against a string constant.
Summary:
Add relational benchmark against a string constant.
These can potentially trigger inlining of the operations. We want to
benchmark that.

Reviewers: EricWF

Subscribers: christof, jdoerfert, libcxx-commits

Tags: #libc

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

llvm-svn: 356680
2019-03-21 16:06:15 +00:00
Louis Dionne f3486db1f7 [libc++] Mark bad_any_cast tests as unsupported when the dylib doesn't support bad_any_cast
With the latest compiler fix to availability, some availability failures
that didn't trigger before now trigger.

llvm-svn: 356678
2019-03-21 15:37:11 +00:00
Eric Fiselier c9f4cbf7a6 Add dylib-has-no-filesystem when filesystem is disabled
llvm-svn: 356640
2019-03-21 02:13:30 +00:00
Eric Fiselier e7e268d942 Mark debug death tests as unsupported on Windows
llvm-svn: 356639
2019-03-21 02:07:55 +00:00
Eric Fiselier 0e04ab7e94 Remove type visibility specifiers from new chrono types.
_LIBCPP_TYPE_VIS is only really needed on types with a vtable.
And on Windows it doesn't work with types that have only inline methods.

This patch removes the unneeded attributes.

llvm-svn: 356637
2019-03-21 01:48:15 +00:00
Billy Robert O'Neal III 277cf30d6c [libcxx] [test] Revert r356632 add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]]."
llvm-svn: 356635
2019-03-21 00:24:43 +00:00
Eric Fiselier f1d87f8b4c Allow disabling of filesystem library.
Summary: Filesystem doesn't work on Windows, so we need a mechanism to turn it off for the time being.

Reviewers: ldionne, serge-sans-paille, EricWF

Reviewed By: EricWF

Subscribers: mstorsjo, mgorny, christof, jdoerfert, libcxx-commits

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

llvm-svn: 356633
2019-03-21 00:04:31 +00:00
Billy Robert O'Neal III 49fc265581 [libcxx] [test] Add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]].
This allows these tests to pass when compiled by MSVC++.

llvm-svn: 356632
2019-03-20 23:58:46 +00:00
Nico Weber 0fd00a581d libc++/win: Make once_flag have the same size as a pointer.
`unsigned long` is 32-bit on 32-bit systems and 64-bit on 64-bit systems
on LP64 systems -- which most Unix systems are, but Windows isn't.
Windows is LLP64, which means unsigned long is 32-bit even on 64-bit
systems.

pplwin.h contains

    static_assert(alignof(void *) == alignof(::std::once_flag), ...)

which fails due to this problem.

Instead of unsigned long, use uintptr_t, which consistently is 32-bit
on 32-bit systems and 64-bit on 64-bit systems.

No functional change except on 64-bit Windows.

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

llvm-svn: 356624
2019-03-20 22:55:03 +00:00
Louis Dionne fa0573027f [libc++] Mark <filesystem> as unavailable on Apple platforms using pragmas
Summary:
Also add the corresponding XFAILs to tests that require filesystem.
The approach taken to mark <filesystem> as unavailable in this patch
is to mark all the header as unavailable using #pragma clang attribute.
Marking each declaration using the attribute is more intrusive and
does not provide a lot of value right now because pretty much everything
in <filesystem> requires dylib support, often transitively.

This is an alternative to https://reviews.llvm.org/D59093.
A similar (but partial) patch was already applied in r356558.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 356616
2019-03-20 21:18:14 +00:00
Marshall Clow 61914dc2fe Mark <charconv> tests as unsupported for C++11 and C++14 if you're not testing libc++. Thanks to Louis for the suggestion.
llvm-svn: 356602
2019-03-20 19:43:22 +00:00
Louis Dionne 6f3b566c87 [libc++] Use the compiler that CMake found when running lit for back-deployment tests
llvm-svn: 356595
2019-03-20 19:12:27 +00:00
Louis Dionne 2d0b4d6bb3 [libc++][CMake] Clean up some of the libc++ re-exporting logic
Summary:
This change allows specifying the version of libc++abi's ABI to re-export
when configuring CMake. It also clearly identifies which ABI version of
libc++abi each export file contains.

Finally, it removes hardcoded knowledge about the 10.9 SDK for MacOS,
since that knowledge is not relevant anymore. Indeed, libc++ can't be
built with the toolchain that came with the 10.9 SDK anyway because
the version of Clang it includes is too old (for example if you want
to build a working libc++.dylib, you need bugfixes to visibility
attributes that are only in recent Clangs).

Reviewers: dexonsmith, EricWF

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

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

llvm-svn: 356587
2019-03-20 18:16:24 +00:00
Marshall Clow 769c2459d5 Make to_chars/from_chars work back to C++11. This means that we can use them to implement to_string as well. Reviewed as https://reviews.llvm.org/D59598.
llvm-svn: 356585
2019-03-20 18:13:23 +00:00
Louis Dionne 77bca6d296 [NFC] Fix a couple of typos in libc++'s __config
llvm-svn: 356574
2019-03-20 17:05:52 +00:00
Louis Dionne e526a6bd55 [libc++] Do not force going through xcrun to find Clang in the macOS CI scripts
It should be possible to run those CI scripts with different compilers
by simply exporting a different CXX environment variable.

llvm-svn: 356562
2019-03-20 15:40:56 +00:00
Louis Dionne b38c08ac02 [libc++] Mark <filesystem> tests as failing when the dylib doesn't support filesystem
This fixes CI for back-deployment testers on platforms that don't have
<filesystem> support in the dylib.

This is effectively half of https://reviews.llvm.org/D59224. The other
half requires fixes in Clang.

llvm-svn: 356558
2019-03-20 14:34:00 +00:00
Louis Dionne 4d03bbbb3a [libc++] Flag file_clock test as expected to fail with ASAN
This silences a known issue, as can be seen by looking at similar
tests for other clocks, like time.clock.steady/consistency.pass.cpp.

llvm-svn: 356528
2019-03-19 21:53:32 +00:00
Louis Dionne 2b27c00102 [libc++] Complete the ABI changelog after landing <filesystem> in the dylib
llvm-svn: 356523
2019-03-19 21:32:37 +00:00
Louis Dionne cc37af7a36 [libc++] Build <filesystem> support as part of the dylib
Summary:
This patch treats <filesystem> as a first-class citizen of the dylib,
like all other sub-libraries (e.g. <chrono>). As such, it also removes
all special handling for installing the filesystem library separately
or disabling part of the test suite from the lit command line.

Unlike the previous attempt (r356500), this doesn't remove all the
filesystem tests.

Reviewers: mclow.lists, EricWF, serge-sans-paille

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

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

llvm-svn: 356518
2019-03-19 20:56:13 +00:00
Thomas Anderson a0feccdf56 [libc++] Speed up certain locale functions on Windows
The issue is that __libcpp_locale_guard makes some slow calls to setlocale().
This change avoids using __libcpp_locale_guard in snprintf_l().

Fixes https://bugs.llvm.org/show_bug.cgi?id=41131

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

llvm-svn: 356512
2019-03-19 20:30:58 +00:00
Louis Dionne f7b43230b8 Revert "[libc++] Build <filesystem> support as part of the dylib"
When I applied r356500 (https://reviews.llvm.org/D59152), I somehow
deleted all of filesystem's tests. I will revert r356500 and re-apply
it properly.

llvm-svn: 356505
2019-03-19 19:27:29 +00:00
JF Bastien d81df259b3 Fix char.traits.specializations.char8_t main return
llvm-svn: 356504
2019-03-19 19:25:07 +00:00
Eric Fiselier 9b7685d545 Fixup ABI lists on Linux after adding <filesystem> to the dylib.
llvm-svn: 356503
2019-03-19 19:20:43 +00:00
Eric Fiselier 33244990ad Add visibility attributes and inline to some vector methods.
Adding filesystem to the dylib caused some vector symbols to leak
into the set of exported symbols. This patch hides those symbols.

llvm-svn: 356502
2019-03-19 19:19:44 +00:00
Louis Dionne 72122d058b [libc++] Build <filesystem> support as part of the dylib
Summary:
This patch treats <filesystem> as a first-class citizen of the dylib,
like all other sub-libraries (e.g. <chrono>). As such, it also removes
all special handling for installing the filesystem library separately
or disabling part of the test suite from the lit command line.

Reviewers: mclow.lists, EricWF, serge-sans-paille

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

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

llvm-svn: 356500
2019-03-19 19:09:33 +00:00
JF Bastien c3608fc0d6 Fix fenv.pass.cpp signature for main
And make main return.

llvm-svn: 356493
2019-03-19 18:24:11 +00:00
Louis Dionne afd1a23ffb [libc++] Mark internal types of std::filesystem as hidden
Summary:
Otherwise, implicit instantiations of templates with these types can
cause the dylib to start exporting the vtable/RTTI of the instantiation.
Giving hidden visibility to those types causes the compiler to understand
that they are not used outside the dylib, and as a result implicitly
instantiated vtables/RTTI of templates with those internal types will
get hidden visibility.

Reviewers: EricWF

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

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

llvm-svn: 356488
2019-03-19 17:47:53 +00:00
Marshall Clow 9ea0e473f0 Mark 'front()' and 'back()' as noexcept for array/deque/string/string_view. These are just rebranded 'operator[]', and should be noexcept like it is.
llvm-svn: 356435
2019-03-19 03:30:07 +00:00
Eric Fiselier 0f8041b6e2 Remove unused try catch blocks from old debug tests
llvm-svn: 356429
2019-03-19 00:00:30 +00:00
Eric Fiselier cc703de62f Fix test failures after debug mode changes
llvm-svn: 356421
2019-03-18 22:12:09 +00:00
Eric Fiselier 61b302f94f Remove exception throwing debug mode handler support.
Summary:
The reason libc++ implemented a throwing debug mode handler was for ease of testing. Specifically,
I thought that if a debug violation aborted, we could only test one violation per file. This made
it impossible to test debug mode. Which throwing behavior we could test more!

However, the throwing approach didn't work either, since there are debug violations underneath noexcept
functions. This lead to the introduction of `_NOEXCEPT_DEBUG`, which was only noexcept when debug
mode was off.

Having thought more and having grown wiser, `_NOEXCEPT_DEBUG` was a horrible decision. It was
viral, it didn't cover all the cases it needed to, and it was observable to the user -- at worst
changing the behavior of their program.

  This patch removes the throwing debug handler, and rewrites the debug tests using 'fork-ing' style
  death tests.

Reviewers: mclow.lists, ldionne, thomasanderson

Reviewed By: ldionne

Subscribers: christof, arphaman, libcxx-commits, #libc

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

llvm-svn: 356417
2019-03-18 21:50:12 +00:00
Louis Dionne 0c962cb5c8 [libc++][NFC] Promote CMake comment to an actual option description
llvm-svn: 356386
2019-03-18 18:18:01 +00:00
Louis Dionne 2bde5303c7 [libc++] Add a test for PR40977
Even though the header makes the exact same check since https://llvm.org/D59063,
the headers could conceivably change in the future and introduce a bug.

llvm-svn: 356376
2019-03-18 15:40:49 +00:00
Marshall Clow 2fa901c471 Update a deque test with more assertions. NFC
llvm-svn: 356266
2019-03-15 15:00:41 +00:00
Marshall Clow 5bcca9ffd1 Mark vector::operator[] and front/back as noexcept. We already do this for string and string_view. This should give better codegen inside of noexcept functions. Add tests for op[]/front/back/at, because apparently we had none.
llvm-svn: 356224
2019-03-15 00:29:35 +00:00
Marshall Clow 3068500aa7 XFAIL this debug-mode test that I just broke. Eric has a patch out for review (D59166) that rewrites this test completely, so I'm not going to bother fixing it.
llvm-svn: 356211
2019-03-14 22:24:32 +00:00
Marshall Clow 5f6a5ac19c Add noexcept to operator[] for array and deque. This is an extension. We already do this for string and string_view. This should give better codegen inside of noexcept functions.
llvm-svn: 356209
2019-03-14 21:56:57 +00:00
Marshall Clow 0d8df98328 Reorg the midpoint pointer test into runtime and constexpr tests; comment out the volatile constexpr tests for GCC because our experimental gcc bot barfs on them.
llvm-svn: 356177
2019-03-14 17:43:41 +00:00
Marshall Clow 6f8dddf169 Fix two of the three bot failures for midpoint; the ones regarding the lack of '__int128_t'
llvm-svn: 356169
2019-03-14 17:20:02 +00:00
Louis Dionne 702411fc29 [libc++][CMake] Do not define `cxx_shared_EXPORTS` when building the shared library
CMake will define -Dcxx_shared_EXPORTS when building the shared library
by default. In theory, this is used to signal to the library that we're
building a shared library and that dllimport/dllexport should be used.
However, we already have our own way of doing that, so I'm removing this
define to avoid meaningless command line arguments in the build.

llvm-svn: 356167
2019-03-14 17:15:47 +00:00
Marshall Clow 330ab33f7c Add std::midpoint for integral and poiner types. Described in P0811, reviewed as D59099.
llvm-svn: 356162
2019-03-14 16:25:55 +00:00
Louis Dionne 850a3d3b92 [libc++][CMake] Fix typo introduced in r356150
That typo broke the build when the shared library build was disabled.

llvm-svn: 356155
2019-03-14 14:52:26 +00:00
Louis Dionne 30f305efe2 [libc++] Do not force building with -fPIC (re-applying)
Summary:
In r355746, we stopped forcing to build with -fPIC because that should
be specified by the CMAKE_POSITION_INDEPENDENT_CODE option at CMake
configure time (and by default -fPIC is used for shared libraries anyways).

However, r355746 had to be reverted in r355756 because we were not
actually building the shared library with -fPIC. The reason is that
we were sharing an object library between the static and the shared
library, which caused flags for static libraries to be used when
building object files that were going to be used for a shared library.

Since this was resolved by r356150, we can stop forcing -fPIC again.

Reviewers: EricWF, smeenai

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

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

llvm-svn: 356153
2019-03-14 14:38:38 +00:00
Louis Dionne 989eca62c6 [libc++] Do not share an object library to create the static/shared libraries
Summary:
The problem with using an object library for doing this is that it prevents
the shared library and the static library from being built with the right
default flags. For example, CMake will build shared libraries with -fPIC
by default, but not static libraries. Using an object library to create
the shared library will prevent the right default flags for shared
libraries from being used.

As a side effect, this patch also localizes the logic related to building
a hermetic static library to the static library case, making clear that
this has no effect on the shared library.

Reviewers: phosek, EricWF

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

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

llvm-svn: 356150
2019-03-14 14:19:08 +00:00
Eric Fiselier dfce2dd21e Properly constrain basic_string(Iter, Iter, Alloc = A())
llvm-svn: 356140
2019-03-14 12:31:10 +00:00
Louis Dionne a470a13a70 [libc++] Enable deprecation warnings by default
Summary:
In r342843, I added deprecation warnings to some facilities that were
deprectated in C++14 and C++17. However, those deprecation warnings
were not enabled by default.

After discussing this on IRC, we had finally gotten consensus to enable
those warnings by default, and I'm getting around to doing that only
now.

Reviewers: mclow.lists, EricWF

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

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

llvm-svn: 355961
2019-03-12 20:10:06 +00:00
Eric Fiselier 86af6f5088 Allow optional to tolerate being used with a nested class.
When Clang tries to complete a type containing `std::optional` it
considers the `in_place_t` constructor with no arguments which checks
if the value type is default constructible. If the value type is a
nested class type, then this check occurs too early and poisons the
is_default_constructible trait.

This patch makes optional deduce `in_place_t` so we can prevent
this early SFINAE evaluation. Technically this could break people
doing weird things with the in_place_t tag, but that seems less
important than making the nested class case work.

llvm-svn: 355877
2019-03-11 22:55:21 +00:00
Louis Dionne 3836a49039 [libc++] Remove empty header xlocale/xlocale.h
Summary:
I can't think of a reason for shipping this empty header. If there is
a reason to do so, then hopefully this review can uncover it.

Reviewers: mclow.lists, EricWF

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

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

llvm-svn: 355829
2019-03-11 15:41:51 +00:00
Eric Fiselier 7ffcd984c4 LWG 2843 "Unclear behavior of std::pmr::memory_resource::do_allocate()"
Patch by Arthur O'Dwyer.
Reviewed as https://reviews.llvm.org/D47344

new_delete_resource().allocate(n, a) has basically two permissible results:

* Return an appropriately sized and aligned block.
* Throw bad_alloc.

Before this patch, libc++'s new_delete_resource would do a third and impermissible thing, which was
to return an appropriately sized but inappropriately under-aligned block. This is now fixed.

(This came up while I was stress-testing unsynchronized_pool_resource on my MacBook. If we can't
trust the default resource to return appropriately aligned blocks, pretty much everything breaks.
For similar reasons, I would strongly support just patching __libcpp_allocate directly, but I don't
care to die on that hill, so I made this patch as a <memory_resource>-specific workaround.)

llvm-svn: 355763
2019-03-09 00:38:19 +00:00
Eric Fiselier 411210838d Work around dllimport bug with exclude_from_explicit_instantiation.
When dllimport is specified on a class, and
exclude_from_explicit_instatiation is specified on a member, clang-cl
will still expect a definition to be available externally. But this is
not correct.

Surprisingly one one symbol seems to be consistently affected by this
bug. So this patch simply works around it there.

llvm-svn: 355760
2019-03-08 23:59:29 +00:00
Eric Fiselier 3e3d6c9038 Fix C++03 build failure
llvm-svn: 355758
2019-03-08 23:30:26 +00:00
Eric Fiselier 9dd9495a35 Revert "[libc++] Do not force building with -fPIC"
This reverts commit r355764.

CMake does not turn -fPIC on for us by default. so this patch breaks
standalone builds. The only reason it hasn't broken any bots is because
LLVM turns on and specifies '-fPIC' for us.

llvm-svn: 355756
2019-03-08 23:27:46 +00:00
Eric Fiselier 0e1586c4fb Unbork `std::memory_order` ABI.
Summary:
We need to pin the underlying type of C++20' `std::memory_order` to match the C++17 version. Anything less is an ABI break.

At the moment it's `unsigned` before C++20 and `int` after. Or if you're using `-fshort-enums` it's `unsigned char` before C++20 and `int` after.

This patch explicitly specifies the underlying type of the  C++20 `memory_order` to be w/e type the compiler would have chosen for the C++17 version.

Reviewers: mclow.lists, ldionne

Reviewed By: ldionne

Subscribers: jfb, jdoerfert, #libc, zoecarver

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

llvm-svn: 355755
2019-03-08 23:15:54 +00:00
Eric Fiselier 6e4ec6022f Fix PR41017 - Build failure with _LIBCPP_DEBUG=0 and non-const-ref
comparator for std::sort()

Our debug comparator assumed that the comparator it wraps would always
accepts the values by const ref. This isn't required by the standard.

This patch makes our __debug_less comparator forward the constness.

llvm-svn: 355752
2019-03-08 22:58:59 +00:00
Louis Dionne 2714d58901 [libc++] Do not force building with -fPIC
Summary:
Whether we build with -fPIC should be specified by the
CMAKE_POSITION_INDEPENDENT_CODE option at configure time.
Note that this patch doesn't change the behavior when building
by default, since -fPIC is used for shared libraries by default.

Reviewers: EricWF

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

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

llvm-svn: 355746
2019-03-08 22:24:12 +00:00
Louis Dionne 3d678b5336 [NFC] Add missing revision information to ABI Changelog
llvm-svn: 355732
2019-03-08 21:01:25 +00:00
Matthew Voss 1262e52e16 Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"
This broke the windows bots.

This reverts commit 28302c66d2.

llvm-svn: 355725
2019-03-08 20:33:55 +00:00
Petr Hosek 28302c66d2 [runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/
This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory.  Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/<target> and include/ directories, leaving resource directory only
for compiler-rt runtimes and Clang builtin headers.

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

llvm-svn: 355665
2019-03-08 05:35:22 +00:00
Thomas Anderson 516d07de07 [libc++] Fix use-after-free when building with _LIBCPP_DEBUG=1
The issue is the following code:

    __cn1->__add(*__ip);
    (*__ip)->__c_ = __cn1;

`__ip` points into the array of iterators for container `__cn2`.  This code adds
the iterator to the array of iterators for `__cn1`, and updates the iterator to
point to the new container.

This code works fine, except when `__cn1` and `__cn2` are the same container.
`__cn1->__add()` might need to grow the array of iterators, and when it does,
`__ip` becomes invalid, so the second line becomes a use-after-free error.

Simply swapping the order of the above two lines is not sufficient, because of
the memmove() below.  The easiest and most performant solution is just to skip
touching any iterators if the containers are the same.

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

llvm-svn: 355550
2019-03-06 21:10:08 +00:00
Eric Fiselier 2710d8e105 Fix ABI compatibility of `<stdexcept>` with VCRuntime.
Summary:
Currently, libc++'s `<stdexcept>` doesn't play nice with `vcruntime`. Specifically:

* `logic_error` and `runtime_error` have a different layout.
* libc++'s `logic_error` and `runtime_error` override `what()` but `vcruntime` does not.
*  `vcruntime` uses weak vtables for `<stdexcept>` types.
* libc++'s `<stdexcept>` constructors and assignment operators may have different manglings than `vcruntimes`.

This patch makes libc++'s declarations in `<stdexcept>` match those provided by MSVC's STL as closely as possible.
If MSVC doesn't declare a special member, then neither do we. This ensures that the implicit definitions have the same linkage, visibility, triviality, and noexcept-ness.







Reviewers: thomasanderson, ldionne, smeenai

Reviewed By: thomasanderson

Subscribers: jdoerfert, libcxx-commits

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

llvm-svn: 355546
2019-03-06 20:31:57 +00:00
Louis Dionne 930007ba76 [libc++] Do not specify the underlying type of memory_order
Summary:
This breaks ABI for folks using -fshort-enums, and does not really buy
us anything.

http://llvm.org/PR40977

Reviewers: mclow.lists, EricWF

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

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

llvm-svn: 355521
2019-03-06 17:07:24 +00:00
Marshall Clow 8eda3ad29d Eradicate all the ptrdiff_ts in span left over from applying P1227. A couple of other minor cleanups. NFC
llvm-svn: 355481
2019-03-06 03:59:44 +00:00
Louis Dionne bbdddb7b0e [libc++] Only add dylib-related features when using the system's libc++
Otherwise, when testing trunk libc++ on an older system, lit will think
that the dylib features are disabled. Ideally, we'd have a notion of
running the tests with/without a deployment target (or, equivalently,
a deployment target representing trunk where everything is as recent
as can be). Since we always have a deployment target right now (which
defaults to the current system), we only enable those features when
we're going to also be testing with the system libc++.

We also need to disable the availability markup when we are not running
a system library flavor, because availability markup does not make sense
when building against the trunk libc++ (which has everything regardless
of what the current system is).

This is a re-application of r353319, which had been reverted due to
CI breakage. This time around, I made sure it didn't break our internal
CI before submitting.

This is also a partial undoing of r348296, in spirit at least. However,
with this patch, availability markup is enabled based on whether we're
using a system library or not, whereas previously one could enable
it or disable it arbitrarily. This was confusing as it led to testing
configurations that don't make sense (such as testing a system library
without availability markup, or trunk testing with availability markup).

llvm-svn: 355451
2019-03-05 22:42:45 +00:00
Davide Italiano 6de760ac4e Reinstate libc++ patches now that the lldb formatter has been updated.
"[libc++] Fix <atomic> failures on GCC"
"[libc++] Change memory_order to an enum class"
"[libc++] decoupling Freestanding atomic<T> from libatomic.a"

llvm-svn: 355427
2019-03-05 18:40:49 +00:00
Davide Italiano 1061cb6a93 [libcxx] Revert set of atomic patches that broke lldb.
Revert "[libc++] Fix <atomic> failures on GCC"
Revert "[libc++] Change memory_order to an enum class"
Revert "[libc++] decoupling Freestanding atomic<T> from libatomic.a"

The lldb formatter nededs to be updated. Shafik and Louis will
coordinate to do so.

llvm-svn: 355417
2019-03-05 17:38:33 +00:00
Louis Dionne 130322e7cc [libc++] Fix <atomic> failures on GCC
Summary:
In https://reviews.llvm.org/D58201, we turned memory_order into an enum
class in C++20 mode. However, we were not casting memory_order to its
underlying type correctly for the GCC implementation, which broke the
build bots. I also fixed a test that was failing in C++17 mode on GCC 5.

Reviewers: EricWF, jfb, mclow.lists

Subscribers: zoecarver

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

llvm-svn: 355409
2019-03-05 15:49:58 +00:00
Louis Dionne b55803283b [libc++] Change memory_order to an enum class
This implements P0439R0.

Thanks to Zoe Carver for the patch.
Differential Revision: https://reviews.llvm.org/D58201

llvm-svn: 355403
2019-03-05 14:50:25 +00:00
Eric Fiselier 1c014d75b4 Fix -fsanitize=vptr badness in <__debug>
Summary:

This patch fixes a lifetime bug when inserting a new container into the debug database. It is
diagnosed by UBSAN when debug mode is enabled. This patch corrects how nodes are constructed
during insertion.

The fix requires unconditionally breaking the debug mode ABI. Users should not expect ABI
stability from debug mode.

Reviewers: ldionne, serge-sans-paille, EricWF

Reviewed By: EricWF

Subscribers: mclow.lists, christof, libcxx-commits

Tags: #libc

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

llvm-svn: 355367
2019-03-05 02:10:31 +00:00
Eric Fiselier e69290dc7f Make VCRuntime ABI configuration a first-class option.
Summary:
On Windows we currently provide two separate ABI configurations. One which defers to `vcruntime` to provide the C++ runtime and another which doesn't.
Using `vcruntime` allows interoperability which programs compiled against the MSVC STL, and should be preferred whenever possible.

When deferring to `vcruntime` much of the ABI we provide changes. Including the layout of `<stdexcept>` types, their vtables, and how the linkage of their members.

This patch introduces the `_LIBCPP_ABI_VCRUNTIME` macro to denote this configuration. It also cleans up the existing configuration for using `vcruntime`.

This cleanup lays the groundwork for fixing a number of ABI and interoperability bugs in  `<stdexcept>`.


Reviewers: thomasanderson, ldionne, smeenai

Reviewed By: smeenai

Subscribers: jdoerfert, libcxx-commits, #libc

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

llvm-svn: 355366
2019-03-05 01:57:01 +00:00
Louis Dionne fc778fa2c5 [libc++] Remove old CMake workaround
We haven't had any complaints so far, and I don't think anybody builds
libc++ from source for that old platform anymore.

llvm-svn: 355336
2019-03-04 20:52:14 +00:00
Eric Fiselier 8b73ab29c3 Install GCC 5 on buildbots to replace GCC 4.9.
LLVM is dropping support for GCC 4.9. This patch adds
a GCC 5 installation to the buildbot image so we can upgrade
the 4.9 bot to GCC 5.

As a temporary workaround until zorg updates, we install GCC 5
as GCC 4.9.

llvm-svn: 355334
2019-03-04 20:49:18 +00:00
Louis Dionne 21450545d1 [libc++] decoupling Freestanding atomic<T> from libatomic.a
This patch introduces non-lockfree atomics that do not require using
an external libatomic. This work is done with the long-term goal of
allowing the use of <atomic> in freestanding environments.

Thanks to Olivier Giroux for the patch.
Differential Revision: https://reviews.llvm.org/D56913

llvm-svn: 355318
2019-03-04 15:26:27 +00:00
Louis Dionne afde07ce97 [libc++] Fix forgotten fclose() in unit test
Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D58732

llvm-svn: 355162
2019-03-01 01:32:44 +00:00
Louis Dionne e90085029c [libc++] Increase portability of xalloc test
Do not assume that xalloc() starts at 0, which is not specified by the
Standard.

Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D58299

llvm-svn: 355160
2019-03-01 00:51:54 +00:00
Louis Dionne 4fcdf21406 [NFC][libc++] Update comment about oldest supported macosx for back-deployment
llvm-svn: 355043
2019-02-27 23:36:22 +00:00
Louis Dionne ab19068b7f [libc++] Add is_nothrow_convertible from P0758R1
Reviewed as https://reviews.llvm.org/D58019.
Thanks to Zoe Carver for the patch.

llvm-svn: 355010
2019-02-27 17:57:38 +00:00
Louis Dionne 1be935f418 [libc++] Remove visibility-related warnings with Clang 8
The attributes were placed incorrectly -- they need to be after the
"struct" keyword, not before.

llvm-svn: 355006
2019-02-27 17:33:25 +00:00
Marshall Clow 5c814099c7 I changed a 'enable_if<...>::type to' 'enable_if_t<...>' but forgot to remove the preceding 'typename'
llvm-svn: 354995
2019-02-27 16:09:35 +00:00
Marshall Clow 02e1651c1f Implment the last part of P1024: tuple-like interface to span. Reviewed as https://reviews.llvm.org/D58706.
llvm-svn: 354988
2019-02-27 15:41:37 +00:00
Marshall Clow 2ffa170515 In the review of D58642, Louis asked: 'Is there a reason for making this inline? Templates are already inline by default'. I told him that I didn't want to change the one call (ssize) that I was adding, but would come back later and clean them all (data/empty/begin/end/cbegin/cend/rbegin/rend/crbegin/crend/size/ssize) up later. Now it is later. Remove the unnecessary 'inline' modifiers from all these calls.
llvm-svn: 354952
2019-02-27 03:25:43 +00:00
Marshall Clow 7d3986ea30 Implement the second part of P1227R2 - Signed ssize() functions. Reviewed as https://reviews.llvm.org/D58642
llvm-svn: 354950
2019-02-27 02:58:56 +00:00
Marshall Clow ded9f0efad Fix an ambiguity in the tests that gcc-tot complained about.
llvm-svn: 354944
2019-02-27 01:29:52 +00:00
Louis Dionne 62f3900715 [libc++] Add a test for PR14074
PR14074 was fixed in r165884, but no tests were added.

llvm-svn: 354943
2019-02-27 01:29:09 +00:00
Louis Dionne 25838c6dac [libc++] Mark several tests as XFAIL on macosx10.7
Those tests fail when linking against a new dylib but running against
macosx10.7. I believe this is caused by a duplicate definition of the
RTTI for exception classes in libc++.dylib and libc++abi.dylib, but
this matter still needs some investigation.

This issue was not caught previously because all the tests always linked
against the same dylib used for running (because LIT made it impossible
to do otherwise before r349171).

rdar://problem/46809586

llvm-svn: 354940
2019-02-27 00:57:57 +00:00
Marshall Clow 7ad06a9319 First part of P1227R2 - change span over to use 'size_t' instead of 'ptrdiff_t'. Reviewed as https://reviews.llvm.org/D58639.
llvm-svn: 354936
2019-02-27 00:32:16 +00:00
Louis Dionne 27f79151ec [libc++] Add <filesystem> to the min-mac macro header test
llvm-svn: 354932
2019-02-26 23:14:58 +00:00
Marshall Clow c0170de222 Remove P1272R1, it was not moved in Kona
llvm-svn: 354904
2019-02-26 18:17:30 +00:00
Marshall Clow a04143ee27 Put a 'first implemented' version into the entry for P1357
llvm-svn: 354901
2019-02-26 17:22:47 +00:00
Marshall Clow 7b4ab3b9e4 Mark several issues (and one paper) as complete. Reviewed as D58099; but I added LWG3101 and LWG3144 and P1357R1 as well.
llvm-svn: 354898
2019-02-26 17:01:00 +00:00
Marshall Clow 46c719ddcd Implement P1357: Traits for [Un]bounded Arrays; adopted in Kona
llvm-svn: 354891
2019-02-26 16:07:03 +00:00
Louis Dionne 5d79eaa82f [libc++] Rename _NOALIAS macro to _LIBCPP_NOALIAS
Summary:
For consistency, libc++ macros always start with _LIBCPP. This should
have no functionality change.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 354848
2019-02-26 06:34:42 +00:00
Marshall Clow 310b75e519 LWG3101 - span's Container constructors need another constraint. Reviewed as https://reviews.llvm.org/D57058.
llvm-svn: 354805
2019-02-25 18:32:57 +00:00
Marshall Clow 4fd0395477 Commit LWG3144 - span does not have a const_pointer typedef. Reviewed as D57039.
llvm-svn: 354802
2019-02-25 17:58:03 +00:00
Marshall Clow 9ab85a69dc First part of P1024: Usability Enhancements for std::span. Remove operator() for indexing, and add 'front' and 'back' calls.
llvm-svn: 354801
2019-02-25 17:54:08 +00:00
Marshall Clow 8a7f4c9891 Update status page with papers/issues adopted in Kona
llvm-svn: 354796
2019-02-25 16:12:00 +00:00
Louis Dionne 73be0cb773 [libcxx] Make sure all experimental tests are disabled when enable_experimental=False
Summary:
Previously, we'd run some experimental tests even when enable_experimental=False
was used with lit.

Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, mclow.lists

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

llvm-svn: 354725
2019-02-23 11:24:03 +00:00
Louis Dionne 431cfbf172 [NFC] Fix incorrect comment in std::function test
llvm-svn: 354537
2019-02-21 00:53:26 +00:00
Dimitry Andric d95da99b91 Fix the build with gcc when `-Wredundant-decls` is passed
Summary:
gcc warns that `__throw_runtime_error` is declared both in `<__locale>`
and `<stdexcept>`, if `-Wredundant-decls` is passed on the command
line; this is the case with FreeBSD when ${WARNS} == 6.

Since `<__locale>` gets its first declaration via a transitive include
of `<stdexcept>`, and the second declaration is after the first
invocation of `__throw_runtime_error`, delete that second declaration.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>

Reviewers: kristina, MaskRay, EricWF, ldionne, ngie

Reviewed By: EricWF

Subscribers: krytarowski, brooks, emaste, dim, christof, jdoerfert, libcxx-commits

Tags: #libc

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

llvm-svn: 354515
2019-02-20 21:01:31 +00:00
Jonas Hahnfeld 66c60d9d71 [compiler-rt] Build custom libcxx with libcxxabi
This changes add_custom_libcxx to also build libcxxabi and merges
the two into a static and hermetic library.
There are multiple advantages:
1) The resulting libFuzzer doesn't expose C++ internals and looks
   like a plain C library.
2) We don't have to manually link in libstdc++ to provide cxxabi.
3) The sanitizer tests cannot interfere with an installed version
   of libc++.so in LD_LIBRARY_PATH.

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

llvm-svn: 354212
2019-02-17 12:16:20 +00:00
Louis Dionne 95601bdd29 [libcxx] Do not assume the number of elements in a moved-from associative container
Reviewed as https://reviews.llvm.org/D57903.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 353955
2019-02-13 16:43:44 +00:00
Louis Dionne 7232a84e68 [libc++] Avoid UB in the no-exceptions mode in a few places
Summary:
A few places in the library seem to behave unexpectedly when the library
is compiled or used with exceptions disabled. For example, not throwing
an exception when a pointer is NULL can lead us to dereference the pointer
later on, which is UB. This patch fixes such occurences.

It's hard to tell whether there are other places where the no-exceptions
mode misbehaves like this, because the replacement for throwing an
exception does not always seem to be abort()ing, but at least this
patch will improve the situation somewhat.

See http://lists.llvm.org/pipermail/libcxx-dev/2019-January/000172.html

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 353850
2019-02-12 16:06:02 +00:00
Petr Hosek 5300d84116 [CMake] Avoid passing -rtlib=compiler-rt when using compiler-rt
We build libc++ and libc++abi with -nodefaultlibs, so -rtlib=compiler-rt
has no effect and results in an 'argument unused during compilation'
warning which breaks the build when using -Werror. We can therefore drop
-rtlib=compiler-rt without any functional change; note that the actual
compiler-rt linking is handled by HandleCompilerRT.

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

llvm-svn: 353786
2019-02-12 01:35:29 +00:00
Eric Fiselier 9ebc9dbd3c Don't declare fenv.h functions when they're a macro.
libc still provides function declarations, and these declarations
conflict with libc++'s

llvm-svn: 353774
2019-02-12 00:05:14 +00:00
Eric Fiselier 1eb19e5277 Make the sym_diff utilities more useful.
In particular when working with static libraries and libstdc++.

llvm-svn: 353772
2019-02-12 00:00:43 +00:00
Eric Fiselier cf39dd44b8 Add fenv.h header
Summary:
Some implementations of fenv.h use macros to define the functions they provide. This can cause problems when `std::fegetround()` is spelled in source.

This patch adds a `fenv.h` header to libc++ for the sole purpose of turning those macros into real functions.

Reviewers: rsmith, mclow.lists, ldionne

Reviewed By: rsmith

Subscribers: mgorny, christof, libcxx-commits

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

llvm-svn: 353767
2019-02-11 23:47:19 +00:00
Petr Hosek 1405ac457b [libcxx] Preserve order, avoid duplicates when merging static archives
glob can return files in arbitrary order which breaks deterministic
builds. Rather, use `ar t` to list the files in each archive and
preserve the original order. Using `ar q` results in duplicate entries
in the archive, instead use `ar r` to avoid duplicates.

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

llvm-svn: 353671
2019-02-11 08:48:47 +00:00
Chandler Carruth 9d610c5a53 The new file header didn't get carried over when these files were
"moved" somehow, update them to use it.

llvm-svn: 353669
2019-02-11 08:39:23 +00:00
Chandler Carruth a20f61106b Update some newly added files that mistakenly used the old file header
to the new one.

llvm-svn: 353668
2019-02-11 08:39:14 +00:00