Commit Graph

2151 Commits

Author SHA1 Message Date
Marshall Clow
70e8f59884 Fix a crasher found by libFuzzer
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245849 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-24 15:57:09 +00:00
Eric Fiselier
bb2f28e15d Recommit rL245802: Cleanup fancy pointer rebinding in list using __rebind_pointer.
Currently we need an #ifdef branch every time we use pointer traits to rebind a pointer because
it is done differently in C++11 and C++03. This patch introduces the __rebind_pointer utility to
clean this up.

Also add a test that list and it's iterators can be instantiated with incomplete element types.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245806 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-23 02:56:05 +00:00
Eric Fiselier
d686dda62e Revert r245802. It violates the incomplete type requirements.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245805 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-23 02:39:20 +00:00
Eric Fiselier
a276cb01be Cleanup fancy pointer rebinding in list using __rebind_pointer.
Currently we need an #ifdef branch every time we use pointer traits to rebind a pointer because
it is done differently in C++11 and C++03. This patch introduces the __rebind_pointer utility to
clean this up. 

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245802 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-23 02:34:18 +00:00
Eric Fiselier
a73d0926fc Refactor shared_timed_mutex tests.
First I removed all of the uses of _LIBCPP_STD_VER and added LIT UNSUPPORTED tags to prevent the tests from being run in older standard dialects.
Second I increased the time tolerances used in some tests when testing with Thread Sanitizer because thread sanitizer make these tests take longer.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245793 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-22 21:24:01 +00:00
Eric Fiselier
2fdc443f37 Fix default value for LLVM_INCLUDE_DOCS in out of tree build.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245790 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-22 20:26:42 +00:00
Eric Fiselier
b9f425a434 [libcxx] Add new Sphinx documentation
Summary:
This patch adds Sphinx based documentation to libc++. The goal is to make it easier to write documentation for libc++ since writing new documentation in HTML is cumbersome. This patch rewrites the main page for libc++ along with the instructions for using, building and testing libc++. 

The built documentation can be found and reviewed here: http://efcs.ca/libcxx-docs

In order to build the sphinx documentation you need to specify the cmake options `-DLLVM_ENABLE_SPHINX=ON -DLIBCXX_INCLUDE_DOCS=ON`. This will add the makefile rule `docs-libcxx-html`.

Reviewers: chandlerc, mclow.lists, danalbert, jroelofs

Subscribers: silvas, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245788 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-22 19:40:49 +00:00
Eric Fiselier
dc68c69e32 Remove completed items from TODO.TXT
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245601 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 19:22:35 +00:00
Eric Fiselier
ed65d0dba5 Fix a typo: overidden -> overridden - Patch from Kai Zhao
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245539 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 05:23:16 +00:00
Eric Fiselier
3d46eb0f6d Fix a typo: abreviated -> abbreviated - Patch from Kai Zhao
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245538 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 05:20:29 +00:00
Eric Fiselier
66d7d70263 Cleanup unique_ptr failure tests and convert them to Clang verify
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245529 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 01:08:03 +00:00
Eric Fiselier
db61736491 Fix one last dynarray test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245528 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 00:20:05 +00:00
Eric Fiselier
fae0070cfc Fix more uses of uninitialized values in dynarray
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245525 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 00:10:22 +00:00
Eric Fiselier
4c4d1aac49 Cleanup failing dynarray tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245522 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 23:33:18 +00:00
Eric Fiselier
f4d8ff9d93 Add files that got missed in r245512.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245513 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 22:35:56 +00:00
Eric Fiselier
672575dadc More unique_ptr test cleanup. Fixes in <memory> to come later.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245512 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 22:35:07 +00:00
Eric Fiselier
de56f74611 [libcxx] Add "install-libcxx" target.
Summary: Currently you can't install libc++ from within the LLVM tree without installing all of LLVM. This patch adds an install rule for libc++.

Reviewers: mclow.lists, danalbert, jroelofs, EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245470 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 17:41:53 +00:00
Eric Fiselier
85b6661a44 Remove test_atomic.h header
Because <atomic> can now be used in C++03 there is no need for the test_atomic.h header.
This commit removes the header and converts all usages to use <atomic> instead.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245468 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 17:37:34 +00:00
Alexey Samsonov
0a6d1e2938 Replace __asan_set_error_exit_code() with __sanitizer_set_death_callback()
Summary: We are going to remove the former soon.

Reviewers: EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245467 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 17:28:01 +00:00
Eric Fiselier
00f4a49b0b [libcxx] Allow use of <atomic> in C++03. Try 3.
Summary:
After putting this question up on cfe-dev I have decided that it would be best to allow the use of `<atomic>` in C++03. Although static initialization is a concern the syntax required to get it is C++11 only. Meaning that C++11 constant static initialization cannot silently break in C++03, it will always cause a syntax error. Furthermore `ATOMIC_VAR_INIT` and `ATOMIC_FLAG_INIT` remain defined in C++03 even though they cannot be used because C++03 usages will cause better error messages.

The main change in this patch is to replace `__has_feature(cxx_atomic)`, which only returns true when C++ >= 11, to `__has_extension(c_atomic)` which returns true whenever clang supports the required atomic builtins.


This patch adds the following macros:
* `_LIBCPP_HAS_C_ATOMIC_IMP`      - Defined on clang versions which provide the C `_Atomic` keyword.
* `_LIBCPP_HAS_GCC_ATOMIC_IMP` - Defined on GCC > 4.7. We must use the fallback atomic implementation.
* `_LIBCPP_HAS_NO_ATOMIC_HEADER` - Defined when it is not safe to include `<atomic>`.

`_LIBCPP_HAS_C_ATOMIC_IMP` and `_LIBCPP_HAS_GCC_ATOMIC_IMP` are mutually exclusive, only one should be defined. If neither is defined then `<atomic>` is not implemented and including `<atomic>` will issue an error.

Reviewers: chandlerc, jroelofs, mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245463 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 17:21:46 +00:00
Dimitry Andric
8966350d61 Fix warnings about pessimizing return moves for C++11 and higher
Summary:
Throughout the libc++ headers, there are a few instances where
_VSTD::move() is used to return a local variable.  Howard commented in
r189039 that these were there "for non-obvious reasons such as to help
things limp along in C++03 language mode".

However, when compiling these headers with warnings on, and in C++11 or
higher mode (like we do in FreeBSD), they cause the following complaints
about pessimizing moves:

    In file included from tests.cpp:26:
    In file included from tests.hpp:29:
    /usr/include/c++/v1/map:1368:12: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
        return _VSTD::move(__h);  // explicitly moved for C++03
               ^
    /usr/include/c++/v1/__config:368:15: note: expanded from macro '_VSTD'
    #define _VSTD std::_LIBCPP_NAMESPACE
                  ^

Attempt to fix this by adding a _LIBCPP_EXPLICIT_MOVE() macro to
__config, which gets defined to _VSTD::move for pre-C++11, and to
nothing for C++11 and later.

I am not completely satisfied with the macro name (I also considered
_LIBCPP_COMPAT_MOVE and some other variants), so suggestions are
welcome. :)

Reviewers: mclow.lists, howard.hinnant, EricWF

Subscribers: arthur.j.odwyer, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245421 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 06:43:33 +00:00
Eric Fiselier
35a6c564bf Use TestAtomic instead of std::atomic so the test can run in C++03
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245415 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 05:00:36 +00:00
Eric Fiselier
faa9a31aef Mark std::packaged_task tests as unsupported in C++03.
std::packaged_task requires variadic templates and is #ifdef out in C++03.
This patch silences the tests in C++03. This patch also rewrites the .fail.cpp tests so that they use clang verify.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245413 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 04:10:15 +00:00
Eric Fiselier
a8dca5f978 Remove commented out TODOs. They defined unneeded methods.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245411 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 03:48:08 +00:00
Eric Fiselier
f99b59c784 Fix use of static_assert macro with nested commas
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245410 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 03:38:41 +00:00
Eric Fiselier
286e0a491b [libcxx] Add Atomic test helper and fix TSAN failures.
Summary:
This patch attempts to fix the last 3 TSAN failures on the libc++ bot (http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-tsan/builds/143). This patch also adds a `Atomic` test type that can be used where `<atomic>` cannot.

`wait.exception.pass.cpp` and `wait_for.exception.pass.cpp` were failing because the test replaced `std::terminate` with `std::exit`. `std::exit` would asynchronously run the TLS and static destructors and this would cause a race condition. See PR22606 and D8802 for more details. 

This is fixed by using `_Exit` to prevent cleanup.

`notify_all_at_thread_exit.pass.cpp` exercises the same race condition but for different reasons. I fixed this test by manually joining the thread before beginning program termination.

Reviewers: EricWF, mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245389 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 23:29:59 +00:00
Eric Fiselier
3b1fb53a65 Move atomic_support.h and config_elast.h into src/include
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245354 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 21:08:54 +00:00
Joerg Sonnenberger
34172f7f1b GC empty directory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245343 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 20:34:33 +00:00
Marshall Clow
d434e2a535 Broke C++03 compatibility in 245330. Fix that.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245336 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 19:51:37 +00:00
Eric Fiselier
8e030714ff [libcxx] Fix PR23589: std::function doesn't recognize null pointer to varargs function.
Summary:
This patch fixes __not_null's detection of nullptr by breaking it down into 4 cases.

1. `__not_null(Tp const&)`: Default case. Tp is not null.
2. `__not_null(Tp* __ptr);` Case for pointers to functions.
3. `__not_null(_Ret _Class::* __ptr);` Case for pointers to members.
4. `__not_null(function<Tp> const&);`: Cases for other std::functions.

Reviewers: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245335 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 19:41:51 +00:00
Eric Fiselier
0376dfaca0 [libc++] Fix PR22606 - Leak pthread_key with static storage duration to ensure all of thread-local destructors are called.
Summary:
See https://llvm.org/bugs/show_bug.cgi?id=22606 for more discussion.

Most of the changes in this patch are file reorganization to help ensure assumptions about how __thread_specific_pointer is used hold. The assumptions are:

* `__thread_specific_ptr<Tp>` is only created with a `__thread_struct` pointer.
* `__thread_specific_ptr<Tp>` can only be constructed inside the `__thread_local_data()` function.

I'll remove the comments before committing. They are there for clarity during review.

Reviewers: earthdok, mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245334 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 19:40:38 +00:00
Eric Fiselier
85d45f6c0d [libcxx] Disable -Wnon-virtual-dtor warning in <locale>
Summary:
Normally people won't see warnings in libc++ headers, but if they compile with "-Wsystem-headers -Wnon-virtual-dtor" they will likely see issues in <locale>.

In the libc++ implementation `time_get' has a private base class, `__time_get_c_storage`, with virtual methods but a non-virtual destructor. 
`time_get` itself can safely be used as a polymorphic base class because it inherits a virtual destructor from `locale::facet`. To placate the compiler we change `__time_get_c_storage`'s destructor from public to protected, ensuring that it will never be deleted polymorphically.

Reviewers: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245333 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 19:39:35 +00:00
Marshall Clow
af961ed8cf implement more of N4258 - Cleaning up noexcept in the standard library. Specifically add new noexcept stuff to vector and string's move-assignment operations
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245330 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 18:57:00 +00:00
Marshall Clow
fc93ce7349 Make regex and any assert when they should throw an exception _but_ the user has decreed 'no exceptions'. This matches the behavior of string and vector
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245239 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-17 21:14:16 +00:00
Eric Fiselier
1efadf976d Fix CMake error whet llvm-config reports a non-existent source directory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@244717 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-12 06:36:19 +00:00
Joerg Sonnenberger
ba865ff66b Protect template argument from user interference.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@244462 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 16:58:04 +00:00
Marshall Clow
bed1d91bf2 Update some links so that they don't point at the (private) WG21 Wiki
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@244047 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 14:36:42 +00:00
Tanya Lattner
d08dbfc12e Update references to lists.llvm.org
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@244003 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 03:59:14 +00:00
Marshall Clow
9a3c689b8a Change char_traits<char16_t>::eof() to return 0xFFFF instead of 0xDFFF. Fixes PR#24342
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243937 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-04 01:38:34 +00:00
Eric Fiselier
c0e7971986 Remove -Werror when using check_cxx_compiler_flag because it was causing compiler-rt breakages.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243784 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 21:09:38 +00:00
Eric Fiselier
6a85d5c674 Print message when configuring for standalone build.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243737 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 06:08:32 +00:00
Eric Fiselier
fe5102c83e Fix failing unique_ptr tests.
When I was refactoring the unique_ptr.single.ctor tests I added a test
deleter, 'NCDeleter', to deleter.h. Other tests that include deleter.h
redefine the NCDeleter type causing test failures.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243733 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 04:34:25 +00:00
Eric Fiselier
76581dc450 Start cleanup of unique_ptr tests.
One of the last sections of tests that still fail in C++03 are the unique_ptr
tests. This patch begins cleaning up the tests and fixing C++03 failures.

The main changes of this patch:
  - The "Deleter" type in "deleter.h" tried to be "move-only" in C++03. However
    the move simulation no longer works (see "__rv"). "Deleter" is now copy
    constructible in C++03. However copying "Deleter" will "move" the test value
    instead of copying it.

  - Reduce the unique.ptr.single.ctor tests files from ~25 to 4. There is no
    reason the tests were split through so many files.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243730 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 02:43:52 +00:00
Eric Fiselier
65a1d45c0a Mark any as done and comment out extra methods until speaking to Marshall
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243729 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 02:29:11 +00:00
Eric Fiselier
7175a07921 [libcxx] Add <experimental/any> v2.
Summary:
This patch adds the second revision of <experimental/any>. 
I've been working from the LFTS draft found at this link. https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#any



Reviewers: danalbert, jroelofs, K-ballo, mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243728 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 02:24:58 +00:00
Eric Fiselier
26d2390a8d Add -Wno-error by default to work around failing compiler-rt builds
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243725 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 01:25:01 +00:00
Eric Fiselier
eb6e2eac6c Reapply working parts of CMake cleanup.
This patch adds the working parts of r243503. The difference with this patch
is that it doesn't include the HandleLLVMOptions.cmake file.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243698 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-30 22:30:34 +00:00
Marshall Clow
0934c750ed Fix PR#24267. use numeric_limits::max instead of ~0 for 'all ones', since that might give wrong answers on a 1's complement machine.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243674 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-30 18:26:34 +00:00
Marshall Clow
36dc080bf6 Change some #ifdefs to #if - thanks to Dexon for thge catch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243641 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-30 13:56:00 +00:00
Eric Fiselier
5514d36c43 Revert recent CMake changes again due to failing compiler-rt builds
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243593 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29 23:46:55 +00:00