Commit Graph

4485 Commits

Author SHA1 Message Date
Marshall Clow a9bf43b1fe Use high_resolution_clock instead of steady_clock. Also now builds with gcc 7.2 (for comparison purposes)
llvm-svn: 322864
2018-01-18 17:01:34 +00:00
Marshall Clow 4f0de28c77 A simple program for testing OSS-Fuzz test cases locally.
llvm-svn: 322863
2018-01-18 16:52:19 +00:00
Eric Fiselier 1903976d37 Update Google Benchmark library
llvm-svn: 322812
2018-01-18 04:23:01 +00:00
Eric Fiselier decf22e50f Fix most GCC test failures.
This patch fixes almost all currently failing tests when
using GCC ToT.

The specific changes are:

(A) Workaround gcc.gnu.org/PR83921 which rejects variables w/o initializers
in constexpr contexts -- even when the variable is an empty class. This
bug has been worked around at all callsites by adding an initializer.
Additionally a new test, constexpr_init.pass.cpp, has been added to
test that Clang doesn't suffer from these bugs.

(B) Fix streambuf.assign/swap.pass.cpp. This test was never actually
calling the swap method as intended. In fact, the swap function it
intended to call was ill-formed when instantiated. GCC diagnosed
this ill-formedness w/o needing an instantiation.

(C) size_delete11.pass.cpp was fixed by adding c++2a to the list of
unsupported dialects.

llvm-svn: 322810
2018-01-18 03:41:06 +00:00
Peter Collingbourne 5e27cce467 libcxx: Define set_unexpected, _get_unexpected and __uncaught_exceptions without dllimport.
It turns out that the MSVC headers define these functions without
dllimport even when compiling with /MD. This change fixes the resulting
compile-time error.

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

llvm-svn: 322794
2018-01-18 00:33:35 +00:00
Eric Fiselier 6b3e48b46a Fix nodiscard failure tests on compilers w/o -verify.
Previously .fail.cpp tests for nodiscard were run with -Wunused-result
being a warning, not an error, when the compiler didn't support -verify.

When -verify isn't enabled this change judiciously adds -Werror=unused-result
when to only the failure tests containing the // expected-error string for nodiscard.

As a drive-by change, this patch also adds a missing // UNSUPPORTED: c++2a to
a test which was only supposed to run in C++ <= 11.

llvm-svn: 322776
2018-01-17 22:48:09 +00:00
Peter Collingbourne b89956c812 libcxx: Disable CFI in function std::get_temporary_buffer.
The specification of this function mandates a cast to uninitialized
T*, which is forbidden under CFI.

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

llvm-svn: 322744
2018-01-17 19:32:35 +00:00
Peter Collingbourne 4bdb80faf2 libcxx: Stop using private MSVC macros in the exception implementation.
Inline the provided "fallback" definitions (which seem to always be
taken) that expand to __cdecl into users. The fallback definitions
for the *CRTIMP* macros were wrong in the case where the CRT is being
linked statically, so define our own macro as a replacement.

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

llvm-svn: 322617
2018-01-17 04:37:04 +00:00
Marshall Clow 12f0a77902 More constexpr algorithms from P0202. search/search_n
llvm-svn: 322566
2018-01-16 15:48:27 +00:00
Marshall Clow a58bdf9f69 Change an internal table of constants for the poisson distribution from
type 'result_type' to 'double'. The only thing that we ever do with
these numbers is to promote them to 'double' and use them in a division.
For small result_types, the values were getting truncated, skewing the
results. Thanks to James Nagurne for the suggestion.

llvm-svn: 322556
2018-01-16 14:54:36 +00:00
Marshall Clow d57c03ddca More constexpr algorithms from P0202: lower_bound, upper_bound, equal_range, binary_search
llvm-svn: 322529
2018-01-16 02:34:41 +00:00
Marshall Clow a38c495f22 Actually CALL the constexpr tests.
llvm-svn: 322528
2018-01-16 02:11:13 +00:00
Marshall Clow 6538e28d5d More constexpr (re P0202) - equal and mismatch
llvm-svn: 322527
2018-01-16 02:04:10 +00:00
Marshall Clow da97ec6c10 Fix constexpr failure on C++11-based buildbots.
llvm-svn: 322507
2018-01-15 19:59:09 +00:00
Marshall Clow 056f15e3c5 More constexpr from P0202. count and count_if. Also fix a comment that Morwenn noted.
llvm-svn: 322506
2018-01-15 19:40:34 +00:00
Marshall Clow 404ee020f0 Some of the tests from earlier today had 'int' as the return type when it should have been 'bool'. Fix that. It doesn't change the behavior of any of the tests, but it's more accurate.
llvm-svn: 322505
2018-01-15 19:32:32 +00:00
Marshall Clow 8694428e36 More P0202 constexpr-ifying. All the find_XXX algorithms in this commit.
llvm-svn: 322504
2018-01-15 19:26:05 +00:00
Marshall Clow 674f9128b7 partition_point gets the P0202 treatment
llvm-svn: 322493
2018-01-15 17:53:34 +00:00
Marshall Clow 706ffef713 More constexpr algorithms from P0202. any_of/all_of/none_of.
llvm-svn: 322492
2018-01-15 17:20:36 +00:00
Marshall Clow 49c7643c39 First part of P0202: Adding constexpr modifiers to functions in <algorithm> and <utility>. This commit is all the is_XXX algorithms.
llvm-svn: 322489
2018-01-15 16:16:32 +00:00
Ekaterina Vaartis b848122b5e Add error code handling to remove_all test
As mentioned by EricWF in revision D41830

llvm-svn: 322351
2018-01-12 05:02:06 +00:00
Volodymyr Sapsai a051024cac [libcxx] Make std::basic_istream::get 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]p9:
  [...] In any case, if n is greater than zero it then stores a null
  character into the next successive location of the array.

rdar://problem/35566567

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 322326
2018-01-11 23:23:49 +00:00
Marshall Clow 0e22bf8cb9 Implement an _is_allocator type trait for use in deduction guides.
llvm-svn: 322306
2018-01-11 19:36:22 +00:00
Marshall Clow 31163f629b Fix some too-big local arrays. Thanks to dcdillon for the patch. Reviewed as D28217
llvm-svn: 322295
2018-01-11 17:16:52 +00:00
Ekaterina Vaartis e44cbaf704 Make std::experimental::filesystem::remove and remove_all return false or 0 if the file doesn't exist
Differential Revision: https://reviews.llvm.org/D41830

llvm-svn: 322293
2018-01-11 17:04:29 +00:00
Peter Collingbourne 4566d827a1 libcxx: Stop providing a definition of __GLIBC_PREREQ.
An application may determine whether the C standard library is glibc
by testing whether __GLIBC_PREREQ is defined. This breaks if libc++
provides its own definition. Instead, define our own macro in our
namespace with the desired semantics.

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

llvm-svn: 322201
2018-01-10 18:16:58 +00:00
Marshall Clow 6b40646bec Fix misspelled macro name - thanks to andrew@ispras.ru for the catch
llvm-svn: 322196
2018-01-10 16:25:04 +00:00
Stephan T. Lavavej 04576cc060 [libcxx] [test] Improve MSVC portability.
test/support/msvc_stdlib_force_include.hpp
When testing MSVC's STL with C1XX, simulate a couple more compiler feature-test macros.

When testing MSVC's STL, simulate a few library feature-test macros.

test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
The vector_size attribute is a non-Standard extension that's supported by Clang and GCC,
but not C1XX. Therefore, guard this with `__has_attribute(vector_size)`.

Additionally, while these tests pass when MSVC's STL is compiled with Clang,
I don't consider this to be a supported scenario for our library,
so also guard this with defined(_LIBCPP_VERSION).

test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
N4713 23.14.10 [func.not_fn]/1 depicts only `call_wrapper(call_wrapper&&) = default;`
and `call_wrapper(const call_wrapper&) = default;`. According to
15.8.2 [class.copy.assign]/2 and /4, this makes call_wrapper non-assignable.
Therefore, guard the assignability tests as libc++ specific.

Add a (void) cast to tolerate not_fn() being marked as nodiscard.

Fixes D41213.

llvm-svn: 322144
2018-01-10 00:39:46 +00:00
Petr Hosek 0f03c79b6d [libcxx] Support the use of compiler-rt in lit tests
Don't link tests against libgcc when compiler-rt is being used.

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

llvm-svn: 322044
2018-01-08 23:36:53 +00:00
Dan Albert 553b09b515 Revert "Make rehash(0) work with ubsan's unsigned-integer-overflow."
Seems to have broken some tests since I first wrote this a while
back. Will reland after checking what went wrong with the tests.

This reverts commit 7023194c8d11a081fd01ed25308b3d60193c6a06.

llvm-svn: 322039
2018-01-08 22:57:12 +00:00
Marshall Clow e426a832dd Apparently 'C++14' is different than 'c++14'
llvm-svn: 322034
2018-01-08 22:16:30 +00:00
Dan Albert 0802327a39 Make rehash(0) work with ubsan's unsigned-integer-overflow.
Reviewers: mclow.lists, EricWF

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 322031
2018-01-08 21:49:12 +00:00
Billy Robert O'Neal III b6e3c55465 Change add_ten to add_one to avoid triggering ubsan integer overflow.
llvm-svn: 322021
2018-01-08 19:45:16 +00:00
Marshall Clow d835e59211 Add the C++17 extensions to std::search. Include the default searcher, but not the Boyer-Moore or Boyer-Moore-Horspool searcher (yet). BUT put the BM and BMH tests in place, marked to XFAIL. The other searchers will follow soon
llvm-svn: 322019
2018-01-08 19:18:00 +00:00
Marshall Clow 86de37aee6 Document upcoming TS feature removal
llvm-svn: 322011
2018-01-08 17:43:46 +00:00
Marshall Clow 464de6ca09 Mark the transparent version set::count() as const. Thanks to Ivan Matek for the bug report.
llvm-svn: 321966
2018-01-07 17:39:57 +00:00
Dimitry Andric 672f7adce5 Add pre-C++11 is_constructible wrappers for 3 arguments
Summary:
After rL319736 for D28253 (which fixes PR28929), gcc cannot compile `<memory>` anymore in pre-C+11 modes, complaining:

```
In file included from /usr/include/c++/v1/memory:648:0,
                 from test.cpp:1:
/usr/include/c++/v1/memory: In static member function 'static std::__1::shared_ptr<_Tp> std::__1::shared_ptr<_Tp>::make_shared(_A0&, _A1&, _A2&)':
/usr/include/c++/v1/memory:4365:5: error: wrong number of template arguments (4, should be at least 1)
     static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" );
     ^
In file included from /usr/include/c++/v1/memory:649:0,
                 from test.cpp:1:
/usr/include/c++/v1/type_traits:3198:29: note: provided for 'template<class _Tp, class _A0, class _A1> struct std::__1::is_constructible'
 struct _LIBCPP_TEMPLATE_VIS is_constructible
                             ^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/v1/memory:648:0,
                 from test.cpp:1:
/usr/include/c++/v1/memory:4365:5: error: template argument 1 is invalid
     static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" );
     ^
/usr/include/c++/v1/memory: In static member function 'static std::__1::shared_ptr<_Tp> std::__1::shared_ptr<_Tp>::allocate_shared(const _Alloc&, _A0&, _A1&, _A2&)':
/usr/include/c++/v1/memory:4444:5: error: wrong number of template arguments (4, should be at least 1)
     static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" );
     ^
In file included from /usr/include/c++/v1/memory:649:0,
                 from test.cpp:1:
/usr/include/c++/v1/type_traits:3198:29: note: provided for 'template<class _Tp, class _A0, class _A1> struct std::__1::is_constructible'
 struct _LIBCPP_TEMPLATE_VIS is_constructible
                             ^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/v1/memory:648:0,
                 from test.cpp:1:
/usr/include/c++/v1/memory:4444:5: error: template argument 1 is invalid
     static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" );
     ^
```

This is also reported in https://bugs.freebsd.org/224946 (FreeBSD is apparently one of the very few projects that regularly builds programs against libc++ with gcc).

The reason is that the static assertions are invoking `is_constructible` with three arguments, while gcc does not have the built-in `is_constructible` feature, and the pre-C++11 `is_constructible` wrappers in `<type_traits>` only provide up to two arguments.

I have added additional wrappers for three arguments, modified the `is_constructible` entry point to take three arguments instead, and added a simple test to is_constructible.pass.cpp.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: krytarowski, cfe-commits, emaste

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

llvm-svn: 321963
2018-01-07 16:45:11 +00:00
Saleem Abdulrasool ae20590c17 Correct mistake in pragma usage for Windows
The autolink pragma was missing the pragma name itself.  This would
result in the pragma being silently dropped.

llvm-svn: 321937
2018-01-06 18:47:03 +00:00
Billy Robert O'Neal III 231d15e086 Add casts to prevent narrowing warnings.
llvm-svn: 321923
2018-01-06 02:50:03 +00:00
Billy Robert O'Neal III 1e1195dce5 [libcxx] [test] Remove nonstandard things and resolve warnings in Xxx_scan tests
Reviewed as https://reviews.llvm.org/D41748

* These tests use function objects from functional, back_inserter from iterator, and equal from algorithm, so add those headers.
* The use of iota targeting vector<unsigned char> with an int parameter triggers warnings on MSVC++ assigning an into a unsigned char&; so change the parameter to unsigned char with a static_cast.
* Avoid naming unary_function in identity here as that is removed in '17. (This also fixes naming _VSTD, _NOEXCEPT_, and other libcxx-isms)
* Change the predicate in the transform tests to add_ten so that problems with multiple application are caught.

llvm-svn: 321922
2018-01-06 02:18:20 +00:00
Martin Storsjo bf02a09103 [cmake] Add a config option LIBCXX_HAS_WIN32_THREAD_API for enforcing win32 threads
This allows keeping libcxx using win32 threads even if a
version of pthread.h is installed.

This matches the existing cmake option LIBCXX_HAS_PTHREAD_API.

Also add missing documentation about the internal define
_LIBCPP_HAS_THREAD_API_WIN32.

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

llvm-svn: 321896
2018-01-05 20:48:29 +00:00
Billy Robert O'Neal III 3770e403ee Move + and * operators of MoveOnly into MoveOnly.h.
llvm-svn: 321852
2018-01-05 01:32:00 +00:00
Billy Robert O'Neal III 4958692ad9 Fix incorrect handling of move-only types in transform_reduce iter iter iter init, and add test.
llvm-svn: 321851
2018-01-05 01:31:57 +00:00
Billy Robert O'Neal III ca444e13dc Automated trailing whitespace removal by VS Code.
llvm-svn: 321850
2018-01-05 01:31:55 +00:00
Billy Robert O'Neal III d432d89454 Add move-only types test to transform_reduce iter iter iter init op op.
llvm-svn: 321849
2018-01-05 01:31:52 +00:00
Billy Robert O'Neal III 1ef4ef2236 Add move-only types test for transform_reduce bop/uop.
llvm-svn: 321848
2018-01-05 01:31:50 +00:00
Billy Robert O'Neal III 61d97da4f4 Fix nonstandard bits in transform_reduce_iter_iter_init_bop_uop.
* _VSTD should be std.
* <utility> is needed for forward.
* unary_function is no longer standard (and unnecessary for this, a C++17-only test)

llvm-svn: 321847
2018-01-05 01:31:47 +00:00
Hans Wennborg 6be97eca93 Update version to 7.0.0svn: cmake, include files and docs
llvm-svn: 321725
2018-01-03 15:40:29 +00:00
Marshall Clow 12e17b19ba Mark LWG2824 as complete. We already did it, but I added a test to be sure
llvm-svn: 321689
2018-01-03 04:37:30 +00:00
Marshall Clow bae5d279ed Mark issue #2866 as "nothing to do"
llvm-svn: 321687
2018-01-03 03:43:32 +00:00