Commit Graph

1980 Commits

Author SHA1 Message Date
Marshall Clow
19158f2fa1 Start a to-do list for libc++
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237813 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 17:39:54 +00:00
Eric Fiselier
bae11add65 Fix building and testing libc++ with GCC.
The changes in src/exception.cpp and cmake/Modules/HandleLibCXXABI.cmake fix a
bug when building libc++ with GCC. Because GCC does not support __has_include
we need to explicitly tell it that we are building against libc++abi via the
preprocessor definition `LIBCXX_BUILDING_LIBCXXABI`.

The changes in include/ratio are to work around CWG defect
1712 (constexpr variable template declarations). GCC 4.8 and before has not
adopted the resolution to this defect.

The changes in include/exception work around an issue where is_final is used
without it being defined in type_traits.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237767 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 03:15:01 +00:00
Eric Fiselier
1a7ccb14e8 Fix race condition in thread test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237745 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 23:41:04 +00:00
Eric Fiselier
5d663441e7 Address @danalberts comments on r237700
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237740 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 23:10:32 +00:00
Eric Fiselier
d539803d4b Fix uninitialized values and bad enum conversions found by UBSAN.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237738 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 23:03:57 +00:00
Eric Fiselier
5486fac53c Rename internal trait that used non-reserved name.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237737 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 22:27:18 +00:00
Eric Fiselier
a985b8cc79 Add compiler flag test support to LIT. Fix new/delete tests on apple-clang.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237700 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 15:15:53 +00:00
Marshall Clow
5dce73dd6e Implement LWG2433: uninitialized_copy()/etc. should tolerate overloaded operator&
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237699 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 15:01:48 +00:00
Eric Fiselier
02be74588a mark new/delete tests as XFAIL more carefully
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237664 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 03:41:22 +00:00
Eric Fiselier
f4c97290fc [libcxx] Rework sized delete.
Summary:
This patch does 2 main things:
1. Enable sized delete if the feature test macro `__cpp_sized_deallocation` is enabled.
2. Rework and cleanup all of the sized delete tests.

Test Plan:
The sized delete replacement tests are now split into 4 files:
1. sized_delete11.pass.cpp: Ensure overriding sized delete in C++11 has no effect.
2. sized_delete14.pass.cpp: Test overriding sized delete in C++14 and ensure it is called. This test fails on clang and GCC < 5.1. 
3. size_delete_calls_unsized_delete_.pass.cpp: Test that the default sized delete calls unsized delete.
4. sized_delete_fsizeddeallocation.pass.cpp: Test overriding sized delete when -fsized-deallocation is passed. This test should pass on clang and GCC >= 5.1

I have also removed a lot of cruft from the old tests. They no longer replace the new handler and tests that it is called for bad allocations.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D9831

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237662 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 02:03:22 +00:00
Marshall Clow
e7b12e343b Mark N4510 as complete; we already do this
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237638 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 23:25:09 +00:00
Marshall Clow
e62560a9b6 Add support for N4389 - std::bool_constant
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237636 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 23:21:06 +00:00
Marshall Clow
bc9ccda541 Update C++1z status; mark issues 2059,2369,2415,2454 and 2458 as 'complete'. I have committed patches for all of them
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237606 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 19:52:49 +00:00
Marshall Clow
c7c52f913d Update C++1z status; mark all the issues that require no library change as 'complete'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237604 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 19:50:05 +00:00
Marshall Clow
de76389219 Update C++1z status with issues and papers from Lenexa
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237596 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 19:01:11 +00:00
Marshall Clow
c42668278d Fix for LWG Issue 2458: N3778 and new library deallocation signatures.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237592 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 17:48:45 +00:00
Logan Chien
21f5b24e2d libcxx: Enhance lit test command in verbose mode.
Print both the compiler command and linker command so that it will be
easier for developers to reproduce the failed test cases.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237530 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-17 00:24:11 +00:00
Marshall Clow
b6d12a2b3a Fix test that was failing on C++03 b/c it was using initializer lists
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237527 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 17:10:49 +00:00
Logan Chien
4f8edc478b Fix build when libunwind is disabled.
The previous commit breaks the builds when libc++abi is not built with
libunwind becuase the default value for LIBCXXABI_USE_LLVM_UNWINDER is
OFF, which is not pythonized.

This CL fix the problem by calling pythonize_bool().



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237519 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 13:10:39 +00:00
Logan Chien
5e5e11d90d libcxx: Fix ARM libc++/abi and libunwind buildbot.
The test cases were crashing due to the mixed usage of the unwinding
functions from both libunwind and libgcc_s.  The unwind functions are
mixed because the "llvm_unwinder" entry is not available in the
lit.site.cfg for libc++.  As a result, "-lgcc_s" is picked instead of
"-lunwind".  The extra option to lit --param=link_flags="-lunwind" won't
help either.

This CL fix the problem by adding llvm_unwinder to lit.site.cfg.in.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237518 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 12:44:31 +00:00
Ed Schouten
22a6d5aede Use clock_gettime()'s CLOCK_REALTIME instead of gettimeofday().
The system_clock::now() function currently uses gettimeofday(). The
problem with gettimeofday() is that it is an obsolete XSI function,
hence unavailable on CloudABI. See:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/gettimeofday.html

Change this code to use clock_gettime() with CLOCK_REALTIME instead,
which is more consistent, as clock_gettime() is already used for
steady_clock.

A previous version of this change actually attempted to change
system_clock::duration, but I reverted this part as it breaks the
existing ABI.

Differential Revision:	http://reviews.llvm.org/D8253
Approved by:	jroelofs


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237390 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 20:54:18 +00:00
Evgeniy Stepanov
56a8c6438a Implement std::experimental::sample.
Following specification in "C++ Extensions for Library Fundamentals":
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4480.html#alg.random.sample



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237264 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-13 16:55:41 +00:00
Eric Fiselier
a5ad9ac48b Document a known build issue on OS X 10.8 and later.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237205 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 22:55:30 +00:00
Marshall Clow
0ad232a882 Fix for LWG Issue 2415: Inconsistency between unique_ptr and shared_ptr
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236953 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-10 13:59:45 +00:00
Marshall Clow
928735abf1 Fix for LWG Issue 2369: constexpr max(initializer_list) vs max_element
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236952 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-10 13:53:31 +00:00
Marshall Clow
488025c316 Fix for LWG Issue 2059: C++0x ambiguity problem with map::erase
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236950 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-10 13:35:00 +00:00
Marshall Clow
3607f8640d Remove some debugging printout lines. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236949 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-10 13:26:57 +00:00
Marshall Clow
dbaf7a0d31 Fix for LWG2454: Add raw_storage_iterator::base() member
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236948 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-10 13:14:08 +00:00
Jonathan Roelofs
d20675f970 Fix typo in www. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236902 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-08 21:11:49 +00:00
Marshall Clow
cd13782c22 Replace two naked references of 'std::' with the macro '_VSTD::'. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236593 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 12:11:22 +00:00
Marshall Clow
4b23a3324a Found a Urbana paper that has library bits
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236356 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-01 22:14:35 +00:00
Richard Trieu
14dbb25449 Fix -Wpessimizing-move warning by remove the call to std::move.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236265 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 21:47:28 +00:00
Marshall Clow
3e879e3d3f Mark LWG#2387 as complete. No code changes needed
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236236 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 15:19:44 +00:00
Marshall Clow
7ceff4ef43 Removed 'complete' from 2408; updated status
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236025 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28 19:35:36 +00:00
Marshall Clow
46a7ec9a3d Fix some preprocessor directives that were generating warnings in the test suite.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@235999 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28 16:52:30 +00:00
Marshall Clow
8f916f1c7c Update C++17 status; mark issues 2170, 2377, and 2408 as complete. We already do these; no code changes necessary.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@235992 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28 14:26:29 +00:00
Marshall Clow
71ed9f00d2 Fixed an 'extra tokens at end of #endif directive' warning in experimental/ratio
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@235607 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-23 16:45:08 +00:00
Eric Fiselier
c254b36c29 Remove constexpr support for std::apply because it introduces regressions.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@235274 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-19 15:32:52 +00:00
Marshall Clow
e9d030687d A few bits of N2994 didn't get fully implemented a long time ago. Thanks to STL@microsoft.com for the bug report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@235134 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-16 21:36:54 +00:00
Marshall Clow
3a4964aef3 Qualify an internal call in is_assignable to prevent ADL lookup, which would 'complete' an type definition unnecessarily. Thanks to Richard Smith for the report.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@234886 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-14 13:53:53 +00:00
Marshall Clow
66302c650b In many places, there was an #ifdef/#else block that selected one of two implmentations of rebind_alloc based on whether or not we had template aliases. Create a helper struct to encapsulate that bit of logic, and replace all the ifdefs with uses of that struct. No functionality change intented.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@234296 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 05:21:38 +00:00
Eric Fiselier
6be02cb83f Fix race conditions in test class used throughout the std::thread tests.
The test class 'G' reads and writes to the same static variables in its
constructor, destructor and call operator. When threads are
constructed using `std::thread t((G()))` there is a race condition between the
destruction of the temporary and the execution of `G::operator()()`.

The fix is to simply create the input before creating the thread.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233946 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-02 21:12:17 +00:00
Eric Fiselier
1d55ecf513 [libcxx] Fix bug in shared_timed_mutex that could cause a program to hang.
Summary:
The summary of the bug, provided by Stephan T. Lavavej:

In shared_timed_mutex::try_lock_until() (line 195 in 3.6.0), you need to deliver a notification.  The scenario is:
 
* There are N threads holding the shared lock.
* One thread calls try_lock_until() to attempt to acquire the exclusive lock.  It sets the "I want to write" bool/bit, then waits for the N readers to drain away.
* K more threads attempt to acquire the shared lock, but they notice that someone said "I want to write", so they block on a condition_variable.
* At least one of the N readers is stubborn and doesn't release the shared lock.
* The wannabe-writer times out, gives up, and unsets the "I want to write" bool/bit.
 
At this point, a notification (it needs to be notify_all) must be delivered to the condition_variable that the K wannabe-readers are waiting on.  Otherwise, they can block forever without waking up.



Reviewers: mclow.lists, jyasskin

Reviewed By: jyasskin

Subscribers: jyasskin, cfe-commits

Differential Revision: http://reviews.llvm.org/D8796

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233944 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-02 21:02:06 +00:00
Eric Fiselier
2cea80b137 Remove statement with no effect inside tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233816 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-01 15:49:02 +00:00
Eric Fiselier
088ed9fe94 [libcxx] Optimize vectors uninitialized construction of trivial types from an iterator range.
Summary:
In certain cases vector can use memcpy to construct a range of elements at the back of the vector. We currently don't do this resulting in terrible code gen in non-optimized mode and a
very large slowdown compared to libstdc++. 

This patch adds a `__construct_forward_range(Allocator, Iter, Iter, _Ptr&)` and `__construct_forward_range(Allocator, Tp*, Tp*, Tp*&)` functions to `allocator_traits` which act similarly to the existing `__construct_forward(...)` functions.

This patch also changes vectors `__construct_at_end(Iter, Iter)` to be `__construct_at_end(Iter, Iter, SizeType)` where SizeType is the size of the range. `__construct_at_end(Iter, Iter, SizeType)` now calls `allocator_traits<Tp>::__construct_forward_range(...)`. 

This patch is based off the design of `__swap_out_circular_buffer(...)` which uses `allocator_traits<Tp>::__construct_forward(...)`.

On my machine this code performs 4x better than the current implementation when tested against `std::vector<int>`. 



Reviewers: howard.hinnant, titus, kcc, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8109

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233711 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31 16:54:19 +00:00
Eric Fiselier
bf9653d85f [libcxx] Add code coverage configuration to CMake and LIT.
Summary:
This patch adds configuration to CMake and LIT for running the libc++ test-suite to generate code coverage.

To use code coverage use following instructions.

* Find the clang resource dir using `$CXX -print-search-dirs`. Let <library-dir> be the first library search directory.
* `cmake <regular-options> -DLIBCXX_GENERATE_COVERAGE=ON -DLIBCXX_COVERAGE_LIBRARY=<library-dir>/lib/<platform>/libclang_rt.profile.a <source>`
* `make cxx`
* `make check-libcxx`
* `make generate-libcxx-coverage`


The reason I want this patch upstreamed is so I can setup a bot that generates code coverage and posts in online for every revision. 



Reviewers: mclow.lists, jroelofs, danalbert

Reviewed By: danalbert

Differential Revision: http://reviews.llvm.org/D8716

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233669 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31 04:15:45 +00:00
Eric Fiselier
f68d637860 Allow enabling CCache through an env variable. This helps enable/disable the option on buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233659 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31 01:41:32 +00:00
Marshall Clow
3accbf03e2 Make the new tests better; make sure that we're testing the case where no reallocation has to happen
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233641 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 23:26:16 +00:00
Marshall Clow
86319f01df While testing Erik's code coverage scripts, I found a hole in the test suite - vector::assign where a reallocation was not required had no tests. Add some
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233557 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 16:07:11 +00:00
Eric Fiselier
4bd15469a9 [libcxx] Fix PR22771 - Support access control SFINAE in the library version of is_convertible.
Summary:
Currently the conversion check does not take place in a context where access control SFINAE is applied. This patch changes the context of the test expression so that SFINAE occurs if access control does not permit the conversion.

Related bug: https://llvm.org/bugs/show_bug.cgi?id=22771

Reviewers: mclow.lists, rsmith, dim

Reviewed By: dim

Subscribers: dim, rodrigc, emaste, cfe-commits

Differential Revision: http://reviews.llvm.org/D8461

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233552 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 15:22:20 +00:00