Commit Graph

4427 Commits

Author SHA1 Message Date
Don Hinton 1ec1a9558a [libcxx] Suppress unused warning on apple.
Summary:
This warning is already suppressed on non-apple platforms, so
this change just suppresses it on apple as well.

Reviewers: EricWF, lichray

Reviewed By: lichray

Subscribers: cfe-commits

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

llvm-svn: 321435
2017-12-25 05:33:42 +00:00
Marshall Clow 7d661bb248 Fix the definitions of 'reference' and 'pointer' in string_view that no one uses :-). Thanks to K-ballo for the catch.
llvm-svn: 321188
2017-12-20 16:31:40 +00:00
Peter Collingbourne 22c651c577 libcxx: Fix for basic_stringbuf::seekoff() after r320604.
As a result of this change, the basic_stringbuf constructor that
takes a mode ends up leaving __hm_ set to 0, causing the comparison
"__hm_ - __str_.data() < __noff" in seekoff() to succeed, which caused
the function to incorrectly return -1. The fix is to account for the
possibility of __hm_ being 0 when computing the distance from __hm_
to the start of the string.

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

llvm-svn: 321124
2017-12-19 23:33:16 +00:00
Sam Clegg 5029d676f8 [libcxx] Add WebAssembly support
It turns out that this is the only change required in libcxx
for it to compile with the new `wasm32-unknown-unknown-wasm`
target recently added to Clang.

Patch by Nicholas Wilson!

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

llvm-svn: 320925
2017-12-16 18:59:50 +00:00
Zhihao Yuan 378ae52b10 [libcxx] Fix basic_stringbuf constructor
Summary:
[libcxx] Fix basic_stringbuf constructor

The C++ Standard [stringbuf.cons]p1 defines the effects of the basic_stringbuf
constructor that takes ios_base::openmode as follows:
  Effects: Constructs an object of class basic_stringbuf, initializing the
  base class with basic_streambuf(), and initializing mode with which.
  Postconditions: str() == "".

The default constructor of basic_streambuf shall initialize all its
pointer member objects to null pointers [streambuf.cons]p1.

Currently libc++ calls "str(string_type());" in the aforementioned constructor
setting basic_streambuf's pointers to a non-null value.

This patch removes the call (note that the postcondition str() == ""
remains valid because __str_ is default-initialized) and adds a test checking
that the basic_streambuf's pointers are null after construction.

Thanks Mikhail Maltsev for the patch.

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 320604
2017-12-13 18:12:55 +00:00
Stephan T. Lavavej 4d8a75a1ca [libcxx] [test] Fix line endings, avoid unnecessary non-ASCII.
benchmarks/util_smartptr.bench.cpp
Change CRLF to LF.

test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
Consistently comment "\u20ac" as EURO SIGN, its Unicode name, instead of the actual Unicode character.

test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp
Avoid non-ASCII dash.

Fixes D40991.

llvm-svn: 320536
2017-12-13 00:51:31 +00:00
Stephan T. Lavavej 79e0733c20 [libcxx] [test] Fix MSVC warnings, null pointer deref.
test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp
Silence MSVC warning C4244. This is expected when passing
floating-point values for size.

test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp
test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp
Avoid MSVC "warning C4293: '<<': shift count negative or too big,
undefined behavior". MSVC sees (1ULL << N) and warns - being guarded
by const bool canFit is insufficient. A small change to the code
avoids the warning without the need for a pragma.

Remove a spurious printf() declaration from to_ullong.pass.cpp.

Change ULL to UL in to_ulong.pass.cpp. The ULL suffix was
probably copy-pasted.

test/std/utilities/tuple/tuple.general/ignore.pass.cpp
Use LIBCPP_STATIC_ASSERT for consistency with other files.

test/support/container_test_types.h
Fix a null pointer dereference, found by MSVC /analyze
warning C6011 "Dereferencing NULL pointer 'm_expected_args'."

Fixes D41030.

llvm-svn: 320535
2017-12-13 00:51:27 +00:00
Zhihao Yuan bcde6e715e [libcxx] P0604, invoke_result and is_invocable
Summary:
Introduce a new form of `result_of` without function type encoding.

Rename and split `is_callable/is_nothrow_callable` into `is_invocable/is_nothrow_invocable/is_invocable_r/is_nothrow_invocable_r` (and associated types accordingly)

Change function type encoding of previous `is_callable/is_nothrow_callable` traits to conventional template type parameter lists.


Reviewers: EricWF, mclow.lists, bebuch

Reviewed By: EricWF, bebuch

Subscribers: lichray, bebuch, cfe-commits

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

llvm-svn: 320509
2017-12-12 18:42:04 +00:00
Casey Carter 00c872f353 workaround PR 28385 in __find_exactly_one_checked
Fixes #35578.

Differential Revision: D41048

llvm-svn: 320500
2017-12-12 17:22:24 +00:00
Roger Ferrer Ibanez 6f56d3eee8 [libcxx] Define istream_iterator equality comparison operators out-of-line
Currently libc++ defines operator== and operator!= as friend functions in the
definition of the istream_iterator class template. Such definition has a subtle
difference from an out-of-line definition required by the C++ Standard: these
functions can only be found by argument-dependent lookup, but not by qualified
lookup.

This patch changes the definition, so that it conforms to the C++ Standard and
adds a check involving qualified lookup to the test suite.

Patch contributed by Mikhail Maltsev.

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

llvm-svn: 320363
2017-12-11 13:54:58 +00:00
Shoaib Meenai 927604def6 [libc++] Unbreak Apple buildbots
These buildbots are using the deprecated target name install-libcxx-headers
instead of the more up to date install-cxx-headers, so I need to add an
install-libcxx-headers-stripped target to satisfy them.

llvm-svn: 320201
2017-12-08 21:50:32 +00:00
Stephan T. Lavavej 4626c9a647 [libcxx] [test] Strip trailing whitespace. NFC.
llvm-svn: 319994
2017-12-07 00:50:23 +00:00
Shoaib Meenai f7c7944387 [libc++] Create install-stripped targets
LLVM is gaining install-*-stripped targets to perform stripped installs,
and in order for this to be useful for install-distribution, all
potential distribution components should have stripped installation
targets. LLVM has a function to create these install targets, but since
we can't use LLVM CMake functions in libc++, let's do it manually.

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

llvm-svn: 319959
2017-12-06 21:03:42 +00:00
Saleem Abdulrasool 74f41817a5 Enable auto-linking on Windows
The MSVC driver and clang do not link against the C++ runtime
explicitly.  Instead, they rely on the auto-linking via the pragma
(through `use_ansi.h`) to link against the correct version of the C++
runtime.  Attempt to do something similar here so that linking real C++
code on Windows does not require the user to explicitly specify
`c++.lib` when using libc++ as a C++ runtime on windows.

llvm-svn: 319816
2017-12-05 19:32:49 +00:00
Shoaib Meenai 9a0a00459e [libcxx] Fix intrinsics for MSVC
The parameter was previously renamed but MSVC path was not updated.

Patch by Andrey Khalyavin.

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

llvm-svn: 319802
2017-12-05 17:46:23 +00:00
Marshall Clow fa40ee7779 Mark a couple of internal routines as 'noexcept'
llvm-svn: 319779
2017-12-05 15:56:26 +00:00
Marshall Clow 7700912976 Land D28253 which fixes PR28929 (which we mistakenly marked as fixed before)
llvm-svn: 319736
2017-12-05 04:09:49 +00:00
Marshall Clow c78e12eaf8 Add issue 2587, which was missed
llvm-svn: 319734
2017-12-05 03:51:16 +00:00
Marshall Clow 98360946bb Commit tests for changes in revision 319710
llvm-svn: 319711
2017-12-04 23:04:53 +00:00
Marshall Clow 5dd9220974 Implement more of P0600: '[[nodiscard]] in the library' for C++2a
llvm-svn: 319710
2017-12-04 23:03:42 +00:00
Marshall Clow 936a2fd4b4 Ooops. I checked in a test for a bug I haven't fixed yet. Temporrarily commented it out.
llvm-svn: 319693
2017-12-04 20:46:38 +00:00
Marshall Clow 800259c98d Implement P0457R2: 'String Prefix and Suffix Checking' for c++2a
llvm-svn: 319687
2017-12-04 20:11:38 +00:00
Marshall Clow feb8343281 Fix PR#35948: generate_n does not accept floating point Size arguments.
llvm-svn: 319675
2017-12-04 18:59:14 +00:00
Ben Hamilton e00cd0c408 [libcxx] Set up .arcconfig to point to new Diffusion CXX repository
Summary:
We want to automatically copy the appropriate mailing list
for review requests to the libc++ repository.

For context, see the proposal and discussion here:

http://lists.llvm.org/pipermail/cfe-dev/2017-November/056032.html

Similar to D40179, I set up a new Diffusion repository with callsign
"CXX" for libc++:

https://reviews.llvm.org/source/libcxx/

This explicitly updates libcxx's .arcconfig to point to the new
CXX repository in Diffusion, which will let us use Herald rule H268.

Reviewers: halyavin, EricWF, mclow.lists, compnerd, mstorsjo

Reviewed By: compnerd

Subscribers: cfe-commits, bkramer, dlj, sammccall, klimek, smeenai, mstorsjo, krytarowski

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

llvm-svn: 319666
2017-12-04 17:55:28 +00:00
Hamza Sood 0bf99c6954 Corrected a typo in the building libc++ docs
llvm-svn: 319631
2017-12-03 10:18:35 +00:00
Petr Hosek 5c70428176 [libcxx] Support getentropy as a source of randomness for std::random_device
Use this source use on Fuchsia where this is the oficially way
to obtain randomness. This could be also used on other platforms
that already support getentropy such as *BSD or Linux.

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

llvm-svn: 319523
2017-12-01 06:34:33 +00:00
Petr Hosek 363c631edd Include AddLLVM needed for tests in the right context
AddLLVM is needed for several functions that are used in tests and
as such needs to be included from the right context which previously
wasn't the case.

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

llvm-svn: 319515
2017-12-01 03:16:50 +00:00
Marshall Clow ea44ee202f Fix problems with r'890 when building on machines where sizeof(size_t) != sizeof(unsigned long long) and C++03
llvm-svn: 319106
2017-11-27 22:27:22 +00:00
Marshall Clow a2f3c63282 Revert commit removing allocator support from packaged_task. Will investigate further
llvm-svn: 319091
2017-11-27 20:47:54 +00:00
Marshall Clow d42db7e083 Implement LWG#2921 and LWG#2976 - removing allocator support from packaged_task.
llvm-svn: 319080
2017-11-27 19:43:28 +00:00
Marshall Clow 14d7aac15d Fix PR#35438 - bitset constructor does not zero unused bits
llvm-svn: 319074
2017-11-27 19:03:30 +00:00
Marshall Clow 1ea2f5e374 Fix failure on C++03 bots
llvm-svn: 319042
2017-11-27 16:17:19 +00:00
Marshall Clow 48f3653999 Implement LWG#2948: unique_ptr does not define operator<< for stream output
llvm-svn: 319038
2017-11-27 15:51:36 +00:00
Marshall Clow 3fddff51ba More of P0600; marking allocation routines as [[nodiscard]]
llvm-svn: 318992
2017-11-26 02:55:38 +00:00
Marshall Clow c4eb50563b Fix copy/paste bug in test where we were putting a '3' into a vector<bool>. NFC.
llvm-svn: 318990
2017-11-26 00:39:59 +00:00
Eric Fiselier b7828a8118 Fix installation of cxxabi.h through libc++.
Previously, the install command for the cxxabi headers specified
the wrong component, and therefore they were not being included
in the install-cxx command.

This patch corrects the component name.

llvm-svn: 318989
2017-11-25 23:39:17 +00:00
Marshall Clow 2365c7814a Update C++2a status and add Glen to CREDITS.TXT. Reviewed as https://reviews.llvm.org/D40379
llvm-svn: 318919
2017-11-23 14:50:56 +00:00
Martin Storsjo 771edc7949 Allow to set locale on Windows.
Fix the problem PR31516 with setting locale on Windows by wrapping
_locale_t with a pointer-like class.

Reduces 74 test failures in std/localization test suite to 47 test
failures (on llvm clang, Visual Studio 2015). Number of test failures
doesn't depend on the platform (x86 or x64).

Patch by Andrey Khalyavin.

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

llvm-svn: 318902
2017-11-23 10:38:18 +00:00
Marshall Clow 69b903eecb Add additional 'UNSUPPORTED' to the test case.
llvm-svn: 318897
2017-11-23 05:43:25 +00:00
Marshall Clow b6ad844e13 Add [[nodiscard]] to std::async as part of P0600.
llvm-svn: 318889
2017-11-23 01:25:03 +00:00
Eric Fiselier 3295274725 [libcxx] Implement std::to_address for C++20
Summary: Now implements P0653R2 - Utility to convert to raw pointer.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 318865
2017-11-22 19:49:21 +00:00
Marshall Clow 9180eb1f4a Implement p0137r1 - std::launder. Reviewed as https://reviews.llvm.org/D40144
llvm-svn: 318864
2017-11-22 19:49:03 +00:00
Volodymyr Sapsai 374cff69e0 [libcxx][fixup] Mark std::basic_istream::getline tests as failing for previous libcxx versions.
r318862 added a fix for 0-termination input array in case of an error. Previous
libcxx versions don't have the fix and corresponding tests should be failing.

llvm-svn: 318863
2017-11-22 19:36:54 +00:00
Volodymyr Sapsai 2eb7f433a8 [libcxx] Make std::basic_istream::getline 0-terminate input array in case of error.
It covers the cases when the sentry object returns false and when an exception
was thrown. Corresponding standard paragraph is C++14 [istream.unformatted]p21:
  In any case, if n is greater than zero, it then stores a null character
  (using charT()) into the next successive location of the array.

Patch by Reimar Döffinger.

llvm-svn: 318862
2017-11-22 18:52:36 +00:00
Billy Robert O'Neal III 63db89ff69 Add another test_macros.h include I missed to tuple.by.type.pass.cpp
llvm-svn: 318830
2017-11-22 12:29:17 +00:00
Marshall Clow 4999a5fdd7 Add some tests for operations on const associative containers. Part of LWG#2542
llvm-svn: 318818
2017-11-22 06:02:27 +00:00
Billy Robert O'Neal III 4aef6a08aa Replace assert(true) in tests with actual asserts. Reviewed as https://reviews.llvm.org/D40324
In a17cd7c641c34b6c4bd4845a4d4fb590cb6c238c Marshall added assert(true) to the vector<bool>::size tests, which break on C1XX:

D:\Contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(62): error C2220: warning treated as error - no 'object' file generated
d:\contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(33) : warning C6326: Potential comparison of a constant with another constant.
d:\contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(52) : warning C6326: Potential comparison of a constant with another constant.

The corresponding test for vector::size asserts assert(c.size() == 3);, so I changed it to do that here.

llvm-svn: 318812
2017-11-21 23:03:02 +00:00
Martin Storsjo 837c5b6b13 Remove a broken win32 locale function redirection
One can't replace vsscanf(_l) with a sscanf(_l) that doesn't
take a va_list.

This has been untouched since it was added in SVN r140728, so
apparently it hasn't been used since. One reason for this mistake
originally might have been that there was no _vsscanf_l until MSVC
2015.

Since it's unused, just remove this define.

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

llvm-svn: 318810
2017-11-21 22:41:15 +00:00
Billy Robert O'Neal III 020294811f Add missing test_macros.h inclusion.
llvm-svn: 318808
2017-11-21 22:16:57 +00:00
Billy Robert O'Neal III ba40b0566f Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065
llvm-svn: 318804
2017-11-21 21:37:26 +00:00