Commit Graph

3078 Commits

Author SHA1 Message Date
Eric Fiselier 36103e868b Remove unneeded includes in <exception> after removing __libcpp_throw
llvm-svn: 280743
2016-09-06 19:56:40 +00:00
Marshall Clow 7e1a23001d Fix Bug 30240 - std::string: append(first, last) error when aliasing. Add test cases for append/insert/assign/replace while we're at it, and fix a similar bug in insert.
llvm-svn: 280643
2016-09-05 01:54:30 +00:00
Kuba Brecka 224264ade0 [libcxx] Fix a data race in call_once
call_once is using relaxed atomic load to perform double-checked locking, which contains a data race. The fast-path load has to be an acquire atomic load.

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

llvm-svn: 280621
2016-09-04 09:55:12 +00:00
Eric Fiselier 8e571b551e Apply curr_symbol.pass.cpp test fix to missed test case
llvm-svn: 280612
2016-09-04 04:09:25 +00:00
Eric Fiselier f49fe8f2b6 Fix bad locale test data when using the newest glibc
llvm-svn: 280608
2016-09-04 00:48:54 +00:00
Marshall Clow 2a837eae39 Mark test as XFAIL for C++03, rather than providing a dummy pass.
llvm-svn: 280605
2016-09-04 00:37:06 +00:00
Eric Fiselier ff94d25063 Fix PR30202 - notify_all_at_thread_exit seg faults if run from a raw pthread context.
Summary:
This patch allows threads not created using `std::thread` to use `std::notify_all_at_thread_exit` by ensuring the TL state has been initialized within `std::notify_all_at_thread_exit`.

Additionally this patch "fixes" a potential oddity in `__thread_local_pointer::reset(pointer)`, which would previously delete the old thread local data. However there should *never* be old thread local data because pthread *should* null it out on thread exit. Unfortunately it's possible that pthread failed to do this according to the spec:


> 
> Upon key creation, the value NULL shall be associated with the new key in all active threads. Upon thread creation, the value NULL shall be associated with all defined keys in the new thread.
> 
> An optional destructor function may be associated with each key value. At thread exit, if a key value has a non-NULL destructor pointer, and the thread has a non-NULL value associated with that key, the value of the key is set to NULL, and then the function pointed to is called with the previously associated value as its sole argument. The order of destructor calls is unspecified if more than one destructor exists for a thread when it exits.
> 
> If, after all the destructors have been called for all non-NULL values with associated destructors, there are still some non-NULL values with associated destructors, then the process is repeated. If, after at least {PTHREAD_DESTRUCTOR_ITERATIONS} iterations of destructor calls for outstanding non-NULL values, there are still some non-NULL values with associated destructors, implementations may stop calling destructors, or they may continue calling destructors until no non-NULL values with associated destructors exist, even though this might result in an infinite loop.

However if pthread fails to delete the value it is probably incorrect for us to do it. Destroying the value performs all of the "at thread exit" actions registered with it but we are way past "at thread exit".





Reviewers: mclow.lists, bcraig, EricWF

Subscribers: cfe-commits

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

llvm-svn: 280588
2016-09-03 08:07:40 +00:00
Eric Fiselier ebbcfe7bfc memory_resource still needs init_priority when built with GCC 4.9
llvm-svn: 280585
2016-09-03 07:05:40 +00:00
Eric Fiselier 4efaa30934 Define _LIBCPP_SAFE_STATIC __attribute__((require_constant_initialization)), and apply it to memory_resource
llvm-svn: 280561
2016-09-03 00:11:33 +00:00
Dimitry Andric 54150db232 Avoid narrowing warnings in __bitset constructor
When <bitset> is compiled with warnings enabled, on a platform where
size_t is 4 bytes, it results in errors similar to:

    bitset:265:16: error: non-constant-expression cannot be narrowed
    from type 'unsigned long long' to '__storage_type' (aka 'unsigned
    int') in initializer list [-Wc++11-narrowing]
        : __first_{__v, __v >> __bits_per_word}
                   ^~~
    bitset:676:52: note: in instantiation of member function
    'std::__1::__bitset<2, 53>::__bitset' requested here
            bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
                                                       ^

Fix these by casting the initializer list elements to __storage_type.

Reviewers: mclow.lists, EricWF
Differential Revision: https://reviews.llvm.org/D23960

llvm-svn: 280543
2016-09-02 21:02:11 +00:00
Saleem Abdulrasool e68b47070f cstdio: limit gets to CRT versions below 14
Microsoft removed gets from the CRT in Visual Studio 2015 onwards [1].
Attempting to reference it when targeting CRT versions 14 and above will cause
compile errors.

[1] https://msdn.microsoft.com/en-us/library/2029ea5f.aspx

Patch by Shoaib Meenai!

llvm-svn: 280417
2016-09-01 21:09:19 +00:00
Saleem Abdulrasool 394d351ad7 build: don't add -fPIC on Windows
`-fPIC` doesn't make much sense for Windows, since Windows DLLs aren't compiled
position independent and are instead relocated at runtime.

Patch by Shoaib Meenai!

llvm-svn: 280413
2016-09-01 20:49:54 +00:00
Chris Bieneman a78187a385 [CMake] NFC. Missed the other uses in r280406
Doh! Obviously need to slow down.

llvm-svn: 280407
2016-09-01 19:47:39 +00:00
Chris Bieneman 1c4b97083d [CMake] NFC. Fixing spelling from r280400
Doh!

llvm-svn: 280406
2016-09-01 19:46:02 +00:00
Chris Bieneman bd715f84a4 [CMake] Don't copy headers on fully standalone
In r280108 I tried to make the headers copy relative to LLVM_BINARY_DIR, and the intent was that it would only happen on in-tree builds or runtimes directory builds. It didn't actually work that way.

This patch adds a check for CMAKE_SOURCE_DIR being equal to CMAKE_CURRENT_SOURCE_DIR. In this case we set a variable LIBCXX_USING_INSTLLED_LLVM. This doesn't necessarily mean the LLVM is installed (it could be a build directory), but it means we need to treat the LLVM directory as read-only.

llvm-svn: 280400
2016-09-01 18:46:53 +00:00
Ivan Krasin c735b902a9 Fix libc++ configuration with -fsanitize-coverage
Summary:
a recent change (r280015) in libc++ configuration broke LibFuzzer bot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/12245

It's not restricted just to that bot; any code that uses the sanitize coverage and configures libc++ hits it.

This CL fixes the issue.

Reviewers: compnerd

Subscribers: aizatsky

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

llvm-svn: 280335
2016-09-01 01:38:32 +00:00
Chris Bieneman 0e4c73b24d [CMake] Copy headers relative to LLVM_BINARY_DIR
Summary: This copy phase is only needed for in-tree builds, so we should be copying to the LLVM build directory's include dir instead of the sub-project include dir.

Reviewers: bogner, EricWF

Subscribers: cfe-commits

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

llvm-svn: 280108
2016-08-30 16:51:34 +00:00
Eric Fiselier ea982ed35a Add "FLAKY_TEST" test directive to support re-running flaky tests.
Some of the mutex tests fail on machines with high load. This patch implements
the test directive "// FLAKY_TEST" which allows a test to be run 3 times
before it's considered a failure.

llvm-svn: 280050
2016-08-30 01:46:43 +00:00
Eric Fiselier 7a05dfa791 Fix syntax error in recent CMake change.
llvm-svn: 280042
2016-08-30 01:10:33 +00:00
Eric Fiselier 21125869ed Fix PR28831 - Bad logic around CMAKE_OSX_SYSROOT and CMAKE_OSX_ARCHITECTURES.
See https://llvm.org/bugs/show_bug.cgi?id=28831 for more information about
the changes.

llvm-svn: 280037
2016-08-30 00:54:37 +00:00
Saleem Abdulrasool 124186616a libc++: perform configuration checks with -nodefaultlibs
We're compiling libc++ with -nodefaultlibs, so we should also pass this
option during the configuration checks to ensure those checks are
consistent with the actual build.

The primary motivation here is to ease cross-compilation against a
non-standard set of C++ libraries. Previously, the configuration checks
would attempt to link against the standard C++ libraries, which would
cause link failures when cross-compiling, even though the actual library
link would go through correctly (because of the use of -nodefaultlibs
and explicitly specifying any needed libraries). This is more correct
even ignoring the motivation, however.

Patch by Shoaib Meenai!

llvm-svn: 280015
2016-08-29 21:33:37 +00:00
Eric Fiselier f6ac565031 Fix or suppress GCC warnings during build.
Summary:
Currently a number of GCC warnings are emitted when building libc++. This patch fixes or ignores all of them. The primary changes are:

* Work around strict aliasing issues in `typeinfo::hash_code()` by using __attribute__((may_alias)). However I think a non-aliasing `hash_code()` implementation is possible. Further investigation needed.
* Add `_LIBCPP_UNREACHABLE()` to switch in `strstream.cpp` to avoid -Wpotentially-uninitialized.
* Fix -Wunused-value warning in `__all` by adding a void cast.
* Ignore -Wattributes for now. There are a number of real attribute issues when using GCC but enabling the warning is too noisy.
* Ignore -Wliteral-suffix since it warns about the use of reserved identifiers. Note Only GCC 7.0 supports disabling this warning.
* Ignore -Wc++14-compat since it warns about the sized new/delete overloads.



Reviewers: EricWF

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

llvm-svn: 280007
2016-08-29 20:43:38 +00:00
Eric Fiselier 8b4a30584a Turn On -DLIBCXX_ENABLE_BENCHMARKS by default.
This patch enables the `cxx-benchmarks` target by default. Note that the target
still has to be manually invoked since it isn't included in the default 'make'
rule.

This patch also gets the benchmarks building w/ GCC. The build previously
required the '-stdlib=libc++' flag but upstream patches to Google Benchmark
now allow the library to build w/ libc++ and GCC.

These changes should make the benchmarks easier to build and test.

llvm-svn: 279999
2016-08-29 19:50:49 +00:00
Eric Fiselier 4d5e91d307 Update Google Benchmark library.
llvm-svn: 279989
2016-08-29 19:12:01 +00:00
Eric Fiselier 4268a742f5 Fix pair::operator=(TupleLike&&).
This assignment operator was previously broken since the SFINAE always resulted
in substitution failure. This caused assignments to turn into
copy construction + assignment.

This patch was originally committed as r279953 but was reverted due to warnings
in the test-suite. This new patch corrects those warnings.

llvm-svn: 279955
2016-08-29 01:43:41 +00:00
Eric Fiselier 67c2344174 Revert r279953 - Fix pair::operator=(TupleLike&&)
The test emits warnings causing the test-suite to fail. Since I want this
patch merged into 3.9 I'll recommit it with a clean test.

llvm-svn: 279954
2016-08-29 01:39:54 +00:00
Eric Fiselier 0678cc793a Fix pair::operator=(TupleLike&&).
This assignment operator was previously broken since the SFINAE always resulted
in substitution failure. This caused assignments to turn into
copy construction + assignment.

llvm-svn: 279953
2016-08-29 01:09:47 +00:00
Eric Fiselier e7154709e0 Implement C++17 std::sample.
This patch implements the std::sample function added to C++17 from LFTS. It
also removes the std::experimental::sample implementation which now forwards
to std::sample.

llvm-svn: 279948
2016-08-28 22:14:37 +00:00
Eric Fiselier 040411762f Mark LWG 2716 as complete - shuffle and sample disallows lvalue URNGs.
Libc++'s implementation of shuffle and sample already support lvalue and rvalue
RNG's. This patch adds tests for both categories and marks the issue as complete.

This patch also contains drive-by change for std::experimental::sample which
improves the diagnostics produced when the correct iterator categories are
not supplied.

llvm-svn: 279947
2016-08-28 21:55:00 +00:00
Eric Fiselier 2fc65041be Implement LWG 2711. Constrain path members.
llvm-svn: 279945
2016-08-28 21:26:01 +00:00
Eric Fiselier a13a2056f6 [Docs] Update libc++ target names after r279675.
llvm-svn: 279940
2016-08-28 18:33:08 +00:00
Dimitry Andric f8563f3206 Avoid embedded preprocessor directives in __tree
Similar to rL242623, move C++ version checks outside of _NOEXCEPT_()
macro invocation argument lists, to avoid "embedding a directive within
macro arguments has undefined behavior" warnings.

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

llvm-svn: 279926
2016-08-27 19:32:03 +00:00
Aditya Kumar d51f2a2a64 Add attribute noreturn to functions that throw
Reviewers: mclow.lists, EricWF, howard.hinnant, sebpop
Subscribers: cfe-commits

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

llvm-svn: 279903
2016-08-27 02:26:42 +00:00
Marshall Clow 0fc8cec796 Followon to r279744. Find the other exception types and make __throw_XXX routines (and call them). Remove the generic __libcpp_throw routine, since no one uses it anymore.
llvm-svn: 279763
2016-08-25 17:47:09 +00:00
Marshall Clow 567a1d0478 Remove duplicate inline
llvm-svn: 279746
2016-08-25 15:56:55 +00:00
Marshall Clow d437fa5c8c Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled. Reviewed as: https://reviews.llvm.org/D23855.
llvm-svn: 279744
2016-08-25 15:09:01 +00:00
Aditya Kumar 331fb804c9 Remove trailing WS [NFC]
llvm-svn: 279731
2016-08-25 11:52:38 +00:00
Chris Bieneman f17227a1da [CMake] Be more consistent about naming targets and components
Summary:
The point of this patch is to have a consistent convention for naming build, check and install targets so that the targets can be constructed from the project name.

This change renames a bunch of CMake components and targets from libcxx to cxx. For each renamed target I've added a convenience target that matches the old target name and depends on the new target. This will preserve function of the old targets so that the change doesn't break the world. We can evaluate if it is worth removing the extra targets later.

Reviewers: EricWF

Subscribers: cfe-commits

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

llvm-svn: 279675
2016-08-24 22:17:06 +00:00
Saleem Abdulrasool e81fcb81dc libc++: add an option to build against compiler-rt
This mirrors the option in libc++abi to build without libgcc.

llvm-svn: 279606
2016-08-24 04:22:52 +00:00
Saleem Abdulrasool 7fe0681e28 Revert "libc++: Perform configuration checks with -nodefaultlibs"
This reverts SVN r279584 which broke the buildbots.  Will re-apply once the
issue has been root-caused and fixed.

llvm-svn: 279596
2016-08-24 00:24:05 +00:00
Saleem Abdulrasool 12a0b1f4c8 libc++: Perform configuration checks with -nodefaultlibs
We're compiling libc++ with -nodefaultlibs, so we should also pass this option
during the configuration checks to ensure those checks are consistent with the
actual build.

The primary motivation here is to ease cross-compilation against a non-standard
set of C++ libraries. Previously, the configuration checks would attempt to link
against the standard C++ libraries, which would cause link failures when
cross-compiling, even though the actual library link would go through correctly
(because of the use of -nodefaultlibs and explicitly specifying any needed
libraries). This is more correct even ignoring the motivation, however.

Patch by Shoaib Meenai!

llvm-svn: 279584
2016-08-23 23:01:16 +00:00
Adhemerval Zanella 9704d235d0 libcxx: Fix libcxx tests on aarch64 with libunwind
Some tests uses 'long double' to/from conversions and for some targets
they are provided by compiler runtime (either compiler-rt or libgcc).
However when building libcxx with linunwinder current test configuration
at target_info.py do not include the required libraries, as:

  not llvm_unwinder:
    "-lc++" "-lm" "-lgcc_s" "-lgcc" "-lpthread" "-lc" "-lgcc_s" "-lgcc"

  llvm_unwinder
    "-lc++" "-lm" "-lpthread" "-lc" "-lunwind" "-ldl"

This causes some tests build issues with missing symbols on aarch64,
for instance, where 'long double' is a binary float with 128-bits with
mostly of internal operations being provided by software routines.

This patch changes how to define the default linker flags with libunwinder by
adding libgcc regardless.

I checked and aarch64 and x86_64 with libcxx and libunwind (with and without
LIBCXXABI_USE_LLVM_UNWINDER).

llvm-svn: 279552
2016-08-23 19:25:12 +00:00
Marshall Clow 3820ac3106 Add missing include that caused a test failure on Windows. Thanks to STL for the patch. No functional change.
llvm-svn: 279453
2016-08-22 18:45:31 +00:00
Chris Bieneman 12b134bd4b [CMake] Get libcxx building under LLVM/runtimes
Summary:
The new LLVM runtimes build directory requires some basic conventions across the runtime projects. These changes make libcxx build under the runtimes subdirectory. The general idea of the changes is that the runtimes subdirectory requires some conventions to be consistent across runtime projects.

I expect to have a few more small patches that build on this to tie up check targets and other things useful in development workflows.

Summary of changes in this patch:

* Renamed variable LLVM_CONFIG -> LLVM_CONFIG_PATH
* Renamed variable LIBCXX_BUILT_STANDALONE -> LIBCXX_STANDALONE_BUILD
* Add an include of AddLLVM in the tests subdirectory for add_lit_testsuite.

Reviewers: EricWF

Subscribers: cfe-commits

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

llvm-svn: 279151
2016-08-18 21:31:51 +00:00
Marshall Clow d4e8659dfc make the associative containers do the right thing for propogate_on_container_assignment. Fixes bug #29001. Tests are only for <map> right now - more complete tests will come when we revamp our allocator testing structure.
llvm-svn: 279008
2016-08-17 23:24:02 +00:00
Marshall Clow 2a10c960fa Support allocators with explicit conversion constructors. Fixes bug #29000
llvm-svn: 278904
2016-08-17 05:58:40 +00:00
Adhemerval Zanella ced7928069 libcxx: Fix path.compare.pass expected result
The expected 'filesystem::path::compare' result states that for different
path only result sign contains the information about passed arguments
(not its integer value).  This is due it uses the output of other compare
functions (basic_string_view and char_traits) without further handling and
char_traits uses memcmp for final buffer comparison.

However for GLIBC on AArch64 the code:

  int ret = memcmp ("b/a/c", "a/b/c", 1);

Results in '64' where for x86_64 it results in '1'.

This patch fixes the expected 'filesystem::path::compare' by normalizing
all the results before assert comparison.

llvm-svn: 278745
2016-08-15 21:24:50 +00:00
Eric Fiselier 5f6100260b Fix new ASAN failures
llvm-svn: 278736
2016-08-15 20:50:01 +00:00
Eric Fiselier d9ce291739 Use -O1 when testing with ASAN and MSAN to prevent Clang OOM errors.
Currently certain tests get killed when compiled with ASAN at -O0 because
they eat all of the systems memory. This doesn't happen at -O1, so enable that
to work around the issue.

llvm-svn: 278722
2016-08-15 19:37:20 +00:00
Eric Fiselier 1053e7e967 Fix PR28506. Re-enable missing math.h C++11 decls on SunOS. Patch from Michal Gorny.
llvm-svn: 278716
2016-08-15 18:58:57 +00:00
Eric Fiselier 921a3f1c8d Check in SFINAE base class for use in optional/variant
llvm-svn: 278643
2016-08-15 01:51:54 +00:00
Eric Fiselier 599a842522 Add private option to change build dialect from C++11
Although libc++ only requires C++11 to build, there are other
reasons to turn on a newer dialect in the build. For example
IDE's may not highlight any C++14/C++17 in the headers when
configured for C++11. This patch add's a private option for
changing this.

llvm-svn: 278638
2016-08-14 22:51:54 +00:00
Marshall Clow 82b16766e6 Remove test for the sign of a NaN - doesn't work on MIPS, not strictly legal. Fixes bug 28936
llvm-svn: 278387
2016-08-11 18:46:24 +00:00
Saleem Abdulrasool f5b8d8249e test: relax the FS test a slight bit to be more reliable
Some filesystems track atime always.  This relaxes the test to accept either a
filesystem which does not accurately track atime or does track the atime
accurately.  This allows the test to pass on filesystems mounted with
`strictatime` on Linux or on macOS.

llvm-svn: 278357
2016-08-11 16:58:12 +00:00
Sebastian Pop 51b4aee94f Add 'inline' attribute to __init to inline the basic_string's constructor
basic_string's constructor calls init which was not getting inlined.  This
prevented optimization of const string as init would appear as a call in between
a string's def and use.

Patch by Laxman Sole and Aditya Kumar.

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

llvm-svn: 278356
2016-08-11 16:51:48 +00:00
Eric Fiselier f5feedfa8b Unbreak C++03 build.
llvm-svn: 278323
2016-08-11 08:15:35 +00:00
Eric Fiselier a3e11a5b15 Refactor test archetypes implementation.
llvm-svn: 278319
2016-08-11 07:04:14 +00:00
Eric Fiselier 18dd773016 Add missing REQUIRES for C++14
llvm-svn: 278311
2016-08-11 03:33:41 +00:00
Eric Fiselier 324506b9f3 [libcxx] Add std::any
Summary:
This patch adds std::any by moving/adapting <experimental/any>.

This patch also implements the std::any parts of p0032r3 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0032r3.pdf)
and LWG 2509 (http://cplusplus.github.io/LWG/lwg-defects.html#2509).

I plan to push it in a day or two if there are no comments.


Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 278310
2016-08-11 03:13:11 +00:00
Eric Fiselier 45b7b44867 Implement LWG 2148: Make non-enum default hash specialization well-formed
Summary:
This patch removes the static_assert for non-enum types in the primary hash template. Instead non-enum types create a hash<T> specialization that is not constructible nor callable.

See also:
  * http://cplusplus.github.io/LWG/lwg-active.html#2543
  * https://llvm.org/bugs/show_bug.cgi?id=28917

Reviewers: mclow.lists, EricWF

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 278300
2016-08-10 22:45:26 +00:00
Marshall Clow 7725546a32 std:: quailfy the calls for cend/crend/cbegin/cend. Fixes bug 28927.
llvm-svn: 278282
2016-08-10 20:04:46 +00:00
Matthias Braun 852f990ecb test/hard_link_count(): Fix test on darwin
The hard link count that stat reports are different between normal hfs and the
case sensitive variant. Accept both.

llvm-svn: 278191
2016-08-10 01:02:28 +00:00
Eric Fiselier f6e09e537b Update in-tree Google Benchmark to current ToT.
I've put some work into the Google Benchmark library in order to make it easier
to benchmark libc++. These changes have already been upstreamed into
Google Benchmark and this patch applies the changes to the in-tree version.

The main improvement in the addition of a 'compare_bench.py' script which
makes it very easy to compare benchmarks. For example to compare the native
STL to libc++ you would run:

`$ compare_bench.py ./util_smartptr.native.out ./util_smartptr.libcxx.out`

And the output would look like:

RUNNING: ./util_smartptr.native.out
Benchmark                          Time           CPU Iterations
----------------------------------------------------------------
BM_SharedPtrCreateDestroy         62 ns         62 ns   10937500
BM_SharedPtrIncDecRef             31 ns         31 ns   23972603
BM_WeakPtrIncDecRef               28 ns         28 ns   23648649
RUNNING: ./util_smartptr.libcxx.out
Benchmark                          Time           CPU Iterations
----------------------------------------------------------------
BM_SharedPtrCreateDestroy         46 ns         46 ns   14957265
BM_SharedPtrIncDecRef             31 ns         31 ns   22435897
BM_WeakPtrIncDecRef               34 ns         34 ns   21084337
Comparing ./util_smartptr.native.out to ./util_smartptr.libcxx.out
Benchmark                          Time           CPU
-----------------------------------------------------
BM_SharedPtrCreateDestroy         -0.26         -0.26
BM_SharedPtrIncDecRef             +0.00         +0.00
BM_WeakPtrIncDecRef               +0.21         +0.21

llvm-svn: 278147
2016-08-09 18:56:48 +00:00
Eric Fiselier 344e13892e Remove *super* old test suite results doc for Linux and Windows.
Neither of these results files has been update in years. Linux now has a dozen
or so buildbots tracking it and the Windows results are no longer relevant.
I plan on looking into getting a Windows buildbot going using Appveyor in the
coming days.

llvm-svn: 278087
2016-08-09 03:05:43 +00:00
Petr Hosek 9e49a3376e Allow building both shared and static library
This change allows building both shared and static version of libc++
in a single build, sharing object files between both versions.

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

llvm-svn: 278068
2016-08-08 22:57:25 +00:00
Eugene Zelenko 772d11471c CMakeLists.txt cleanups: synchronize version with rest of LLVM, consistent spacing.
Differential revision: https://reviews.llvm.org/D23091

llvm-svn: 278032
2016-08-08 18:01:50 +00:00
Eric Fiselier 1d711627b4 Fix copy/move constructor annotation for the uses-allocator test types.
Previously the copy/move constructors of the test types did not
properly set the arg_id to T const& or T&& respectivly.

llvm-svn: 277970
2016-08-08 02:22:41 +00:00
Hubert Tong 2fdf202493 [libcxx] Add "flag" default arg: basic_regex ptr_size_flag ctor
Summary:
The synopsis in C++11 subclause 28.8 [re.regex] has:
```
basic_regex(const charT* p, size_t len,
            flag_type f = regex_constants::ECMAScript);
```

The default argument is added to libc++ by this change.

Reviewers: mclow.lists, rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

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

Reapplies r277966.
Patch by Jason Liu!

llvm-svn: 277968
2016-08-07 22:26:04 +00:00
Hubert Tong faf3149df6 Revert r277966. Forgot patch attribution.
llvm-svn: 277967
2016-08-07 22:23:24 +00:00
Hubert Tong 614c406f9e [libcxx] Add "flag" default arg: basic_regex ptr_size_flag ctor
Summary:
The synopsis in C++11 subclause 28.8 [re.regex] has:
```
basic_regex(const charT* p, size_t len,
            flag_type f = regex_constants::ECMAScript);
```

The default argument is added to libc++ by this change.

Reviewers: mclow.lists, rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

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

llvm-svn: 277966
2016-08-07 22:18:33 +00:00
Eric Fiselier da178822c2 Mark LWG 2726 as complete. No code change needed.
llvm-svn: 277964
2016-08-07 21:47:06 +00:00
Eric Fiselier 993f9fad70 Add MSVC specifics to .gitignore. Patch from STL@microsoft.com
llvm-svn: 277575
2016-08-03 05:51:19 +00:00
Eric Fiselier 296d9c79f5 Fix compile error due to mismatched iterator types. Patch from STL@microsoft.com
llvm-svn: 277574
2016-08-03 05:50:03 +00:00
Eric Fiselier 9b32bfb651 Fix an MSVC x64 compiler warning. Patch from STL@microsoft.com
llvm-svn: 277573
2016-08-03 05:48:09 +00:00
Eric Fiselier 7da93bb154 Silence another occurrence of MSVC's suprious unused warning. Patch from STL@microsoft.com
llvm-svn: 277572
2016-08-03 05:46:36 +00:00
Hubert Tong ac98d59802 [libcxx] basic_regex: add traits_type, string_type
Summary:
In the synopsis in C++11 subclause 28.8 [re.regex], `basic_regex` is
specified to have member typedefs `traits_type` and `string_type`. This
change adds them to libc++.

Reviewers: mclow.lists, rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

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

Patch by Jason Liu!

llvm-svn: 277526
2016-08-02 21:34:48 +00:00
Eric Fiselier 84c557ad3e Pass compilers when configuring Google Benchmark.
llvm-svn: 277512
2016-08-02 20:21:07 +00:00
Ben Craig 8ddd3ef9c9 Fixing 'Aquire' typo and libcxx build.
llvm-svn: 277456
2016-08-02 13:43:48 +00:00
JF Bastien 8a63138ebc NFC: fix typo
llvm-svn: 277404
2016-08-01 23:34:29 +00:00
JF Bastien 0f81478c7c atomics.align: XFAIL GCC
It currently fails because GCC changed the mangling of templates, which affects std::atomic using __attribute__((vector(X))). The bot using GCC 4.9 generates the following message:

In file included from /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/test/libcxx/atomics/atomics.align/align.pass.sh.cpp:24:0:
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic: In instantiation of 'atomic_test<T>::atomic_test() [with T = __vector(2) int]':
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/test/libcxx/atomics/atomics.align/align.pass.sh.cpp:66:3:   required from here
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: error: 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(2) int]' conflicts with a previous declaration
     __gcc_atomic_t() _NOEXCEPT = default;
     ^
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: note: previous declaration 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(1) int]'
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: error: 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(2) int]' conflicts with a previous declaration
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: note: previous declaration 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(1) int]'
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:939:5: note: synthesized method 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(2) int]' first required here
     __atomic_base() _NOEXCEPT = default;
     ^

GCC's docs say the following about ABI version 6:
Version 6, which first appeared in G++ 4.7, corrects the promotion behavior of C++11 scoped enums and the mangling of template argument packs, const/static_cast, prefix ++ and –, and a class scope function used as a template argument.

llvm-svn: 277380
2016-08-01 20:28:13 +00:00
Ben Craig adb6d28b0f Adding smart_ptr benchmark
Initial draft here:
https://reviews.llvm.org/D22470
... though this is Eric Fiselier's rewrite to fit in with Google
Benchmark.

llvm-svn: 277373
2016-08-01 19:56:39 +00:00
JF Bastien a2b1c14911 libc++: test lock-free atomic alignment
Summary:
libc++ implements std::atomic<_Tp> using __atomic_base<_Tp> with
`mutable _Atomic(_Tp) __a_`. That member must be suitably aligned on
relevant ISAs for instructions such as cmpxchg to work properly, but
this alignment isn't checked anywhere. __atomic_base's implementation
relies on _Atomic doing "the right thing" since it's under the
compiler's control, and only the compiler knows about lock-freedom and
instruction generation. This test makes sure that the compiler isn't
breaking libc++'s expectations.

I'm looking at a few odd things in the C++ standard, and will have a few
other fixes around this area in the future.

This requires building with `-DLIBCXX_HAS_ATOMIC_LIB=True`, the test
marks the dependency as REQUIRES and won't be run without.

Reviewers: cfe-commits

Subscribers: EricWF, mclow.lists

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

llvm-svn: 277368
2016-08-01 19:27:08 +00:00
Ben Craig ac9eec8602 Improve shared_ptr dtor performance
If the last destruction is uncontended, skip the atomic store on
__shared_weak_owners_. This shifts some costs from normal
shared_ptr usage to weak_ptr uses.

https://reviews.llvm.org/D22470

llvm-svn: 277357
2016-08-01 17:51:26 +00:00
Marshall Clow aa849bc2f2 Add a bunch of noexcepts to char_traits and string_view.
llvm-svn: 276955
2016-07-28 04:52:02 +00:00
Marshall Clow 19b4035f29 Implement LCM and GCD for C++17. Same code as for Library Fundamentals TS.
llvm-svn: 276751
2016-07-26 14:29:45 +00:00
Marshall Clow ab581e79aa Implement LCM and GCD for Library Fundamentals. Reviewed as https://reviews.llvm.org/D21343.
llvm-svn: 276750
2016-07-26 14:28:34 +00:00
Eric Fiselier e26aada915 Remove use of C++1z static assert in C++11 test
llvm-svn: 276608
2016-07-25 04:56:32 +00:00
Eric Fiselier 4927c29577 Implement the std::pair parts of "Improving pair and tuple". Completes N4387.
llvm-svn: 276605
2016-07-25 04:32:07 +00:00
Eric Fiselier aedcbf898b Recommit r276548 - Make pair/tuples assignment operators SFINAE properly.
I think I've solved issues with is_assignable and references to incomplete
types. The updated patch adds tests for this case.

llvm-svn: 276603
2016-07-25 02:36:42 +00:00
Eric Fiselier 79586dca74 Make std::is_assignable tolerate references to incomplete types.
llvm-svn: 276599
2016-07-25 02:08:55 +00:00
Eric Fiselier 189f88ca35 Revert r276548 - Make pair/tuples assignment operators SFINAE properly.
This is a breaking change. The SFINAE required is instantiated the second
the class is instantiated, and this can cause hard SFINAE errors
when applied to references to incomplete types. Ex.

struct IncompleteType;
extern IncompleteType it;
std::tuple<IncompleteType&> t(it); // SFINAE will blow up.

llvm-svn: 276598
2016-07-25 01:45:07 +00:00
Eric Fiselier 93b8e51ebb Make dtor_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com
llvm-svn: 276595
2016-07-25 00:50:32 +00:00
Eric Fiselier 4e91ea50a0 Don't SFINAE pair's copy assignment operator in C++03 mode.
In C++03 mode evaluating the SFINAE can cause a hard error due to
access control violations. This is a problem because the SFINAE
is evaluated as soon as the class is instantiated, and not later.

llvm-svn: 276594
2016-07-25 00:48:36 +00:00
Eric Fiselier 141b2881d7 Mark bucket_count() assertions as non-portable. Patch from STL@microsoft.com
llvm-svn: 276593
2016-07-25 00:26:41 +00:00
Eric Fiselier 249b03effb Make move_assign_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com
llvm-svn: 276591
2016-07-25 00:18:12 +00:00
Eric Fiselier 2cd516e049 Make swap_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com.
See D21820 for more information (https://reviews.llvm.org/D21820).

llvm-svn: 276590
2016-07-25 00:15:29 +00:00
Eric Fiselier b8937d6454 Work around MSVC's non-standard ABI for enums. Patch from STL@microsoft.com
llvm-svn: 276589
2016-07-25 00:02:23 +00:00
Eric Fiselier 44b4f6b85c Fix a non-standard allocator in vector tests. Patch from STL@microsoft.com
llvm-svn: 276588
2016-07-24 23:49:42 +00:00
Eric Fiselier 8c48ebd412 Fix unique_ptr.runtime tests for null inputs. Patch from STL@microsoft.com
llvm-svn: 276587
2016-07-24 23:48:26 +00:00
Eric Fiselier 1662951974 Fix portability issues in <random> tests. Patch from STL@microsoft.com
llvm-svn: 276585
2016-07-24 23:36:18 +00:00
Eric Fiselier 307e4216b2 Mark bucket() assertions as non-portable. Patch from STL@microsoft.com
llvm-svn: 276584
2016-07-24 23:34:18 +00:00
Eric Fiselier 1b3eb43252 Fix MSVC unreferenced parameter warning. Patch from STL@microsoft.com
llvm-svn: 276583
2016-07-24 23:32:48 +00:00
Eric Fiselier f950b85122 Make move_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com
llvm-svn: 276581
2016-07-24 23:19:51 +00:00
Eric Fiselier e028cd8af8 Make bucket_count() greater-equal assertions portable. Patch from STL@microsoft.com
llvm-svn: 276580
2016-07-24 23:16:37 +00:00
Eric Fiselier ee410aca06 Mark bucket_size() assertions as non-portible. Patch from STL@microsoft.com
llvm-svn: 276578
2016-07-24 23:13:36 +00:00
Eric Fiselier 19244b67bc Guard libc++ specific tests SFINAE on std::bind's call operator. Patch from STL@microsoft.com
llvm-svn: 276576
2016-07-24 23:08:21 +00:00
Eric Fiselier d9ac87570e commit test missing from r276556
llvm-svn: 276558
2016-07-24 08:16:37 +00:00
Eric Fiselier 8f5abc12bb Add __is_inplace_type metafunction helper
llvm-svn: 276556
2016-07-24 07:42:13 +00:00
Eric Fiselier 0e100998fc Start adding benchmarks for vector
llvm-svn: 276552
2016-07-24 06:51:55 +00:00
Eric Fiselier 1a06fe5f7e Skip chash computation in insert/emplace if the unconstrained hash matches.
llvm-svn: 276549
2016-07-24 06:22:25 +00:00
Eric Fiselier 904a5d7007 Make pair/tuples assignment operators SFINAE properly.
llvm-svn: 276548
2016-07-24 05:51:11 +00:00
Eric Fiselier 2e99ae4f97 Fix memory leak in test.
llvm-svn: 276547
2016-07-24 04:41:44 +00:00
Eric Fiselier 790df14543 Implement LWG 2393. Check for LValue-callability.
llvm-svn: 276546
2016-07-24 04:16:40 +00:00
Eric Fiselier 63c69ef49c Implement LWG2328. Rvalue stream extraction should perfect forward.
llvm-svn: 276545
2016-07-24 04:07:22 +00:00
Eric Fiselier e4d9c316d2 Implement P0040r3: Extending memory management tools
llvm-svn: 276544
2016-07-24 03:51:39 +00:00
Eric Fiselier 58ad17df0f Implement the in_place tags from p0032r3.
That paper also has changes to any/optional but those will
be implemented later.

llvm-svn: 276537
2016-07-23 22:19:19 +00:00
Eric Fiselier 40492ba417 Fix undefined behavior in __hash_table
Summary:
This patch attempts to fix the undefined behavior in __hash_table by changing the node pointer types used throughout. The pointer types are changed for raw pointers in the current ABI and for fancy pointers in ABI V2 (since the fancy pointer types may not be ABI compatible).

The UB in `__hash_table` arises because tree downcasts the embedded end node and then deferences that pointer. Currently there are 2 node types in __hash_table:

* `__hash_node_base` which contains the `__next_` pointer.
* `__hash_node` which contains `__hash_` and `__value_`.

Currently the bucket list, iterators, and `__next_` pointers store pointers to `__hash_node` even though they all need to store `__hash_node_base` pointers.
This patch makes that change by introducing a `__next_pointer` typedef which is a pointer to `__hash_node` in the current ABI and `__hash_node_base` afterwards.

One notable change is to the type of `__bucket_list` which used to be defined as `unique_ptr<__node_pointer[], ...>` and is now `unique_ptr<__next_pointer[], ...>` meaning that we now allocate and deallocate different types using a different allocator. I'm going to give this part of the change more thought since it may introduce compatibility issues.

This change is similar to D20786.



Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 276533
2016-07-23 20:36:55 +00:00
Eric Fiselier 0fdab5eb69 Implement P0392r0. Integrate filesystem::path and string_view.
llvm-svn: 276511
2016-07-23 03:10:56 +00:00
Eric Fiselier 6f4a165e51 Revert r276506 - Diagnose invalid memory order arguments in <atomic>.
There is a bug in Clang 3.6 and earlier that causes compile failures.
I suspect it's due to the usage of member function parameter names in the
attributes.

llvm-svn: 276507
2016-07-23 01:43:53 +00:00
Eric Fiselier 586b16e16a [libcxx] Diagnose invalid memory order arguments in <atomic>. Fixes PR21179.
Summary:
This patch uses the __attribute__((enable_if)) hack suggested by @rsmith to diagnose invalid arguments when possible.

In order to diagnose an invalid argument `m` to `f(m)` we provide an additional overload of `f` that is only enabled when `m` is invalid. When that function is enabled it uses __attribute__((unavailable)) to produce a diagnostic message.

Reviewers: mclow.lists, rsmith, jfb, EricWF

Subscribers: bcraig, jfb, rsmith, cfe-commits

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

llvm-svn: 276506
2016-07-23 01:16:55 +00:00
JF Bastien aa1bac22dd Remove FIXME for feature test macro
The value I'd picked was correct, as per the recently published SG10 paper http://wg21.link/p0096r3

llvm-svn: 276309
2016-07-21 17:34:28 +00:00
Marshall Clow f067d20c6d Again, w/o the tabs
llvm-svn: 276273
2016-07-21 13:19:36 +00:00
Marshall Clow ef68f26b28 Another fix to appease the no-exception bots.
llvm-svn: 276272
2016-07-21 13:18:50 +00:00
Marshall Clow 187db16996 Fix some string_view tests that were failing when exceptions were disabled. Also comment out a _LIBCPP_ASSERT that gcc4.9 was complaining about. Will revisit that later.
llvm-svn: 276241
2016-07-21 06:24:04 +00:00
Marshall Clow 053d81ceeb Implement std::string_view as described in http://wg21.link/P0254R1. Reviewed as https://reviews.llvm.org/D21459
llvm-svn: 276238
2016-07-21 05:31:24 +00:00
Eric Fiselier 38136197bb Mark P0358r1 as complete. It is already implemented
llvm-svn: 276233
2016-07-21 03:28:52 +00:00
Eric Fiselier 7efa5e4b5f Mark P0337r0 as complete. It was already implemented in std::experimental
llvm-svn: 276231
2016-07-21 03:24:43 +00:00
Eric Fiselier 0e411641a3 Implement P0084r2. Changing emplace return types.
llvm-svn: 276230
2016-07-21 03:20:17 +00:00
Eric Fiselier 192c4f1a4a Disable warning flags when running .fail.cpp tests.
Increasingly the .fail.cpp tests are written using -verify, making them
sensitive to the exact diagnostics generated by the compiler. To prevent
additional diagnostics from being generated, and causing the tests to fail,
this patch removes the warning flags when compiling those tests.

llvm-svn: 276208
2016-07-20 23:37:28 +00:00
Eric Fiselier 7f1b098ab4 Unbreak traits tests by handling differences between version macros in clang/apple-clang.
llvm-svn: 276200
2016-07-20 22:53:21 +00:00
Eric Fiselier b2e7cc6994 Fix inheriting constructor test for std::function.
The test I originally checked in only worked with ToT Clang. This patch
updates the test so that it works as far back as 3.5.

llvm-svn: 276093
2016-07-20 06:46:22 +00:00
Eric Fiselier 85acffa676 Unbreak is_constructible tests for Clang <= 3.7.
There is a bug in Clang's __is_constructible builtin that causes it
to return true for function types; ex [T = void()].

llvm-svn: 276092
2016-07-20 06:36:11 +00:00
Eric Fiselier d5b5359802 Add missed test in r276090.
llvm-svn: 276091
2016-07-20 05:22:35 +00:00
Eric Fiselier fd32ab923e Move std::function constructor SFINAE into template parameter list. Fixes PR20002.
Although inheriting constructors have already been fixed in Clang 3.9 I still
choose to fix std::function so users can derive from it with older compilers.

llvm-svn: 276090
2016-07-20 05:21:00 +00:00
Eric Fiselier b66b621038 Reimplement is_constructible fallback implementation. Fixes PR21574.
The previous implementation relied highly on specializations to handle
special cases. This new implementation lets the compiler do the work when possible.

llvm-svn: 276084
2016-07-20 05:01:24 +00:00
Eric Fiselier 074f8d7777 Add tests for reference binding assertions in std::tuple.
Libc++ provides static assertions to detect reference binding issues inside
tuple. This patch adds tests for those diagnostics.

It should be noted that these static assertions technically violate the
standard since it allows these illegal bindings to occur.

Also see https://llvm.org/bugs/show_bug.cgi?id=20855

llvm-svn: 276078
2016-07-20 02:57:39 +00:00
Eric Fiselier b11642bf94 Add SFINAE on additional overloads of std::complex functions. Fixes PR19921.
The functions arg, conj, imag, norm, proj, and real have additional overloads
for arguments of integral or floating point types. However these overloads should
not allow conversions to the integral/floating point types, only exact matches.

This patch constrains these functions so they no longer allow conversions.

llvm-svn: 276067
2016-07-20 00:14:10 +00:00
Eric Fiselier 331d21599d Add heterogeneous comparator support for __debug_less. Fixes PR17147.
llvm-svn: 276059
2016-07-19 23:27:18 +00:00
Eric Fiselier b08d8b189c [libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:

1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.

Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks`  can be built using the `libcxx-benchmarks` target.

On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.

Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.

Known Issues:

* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.








Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs

Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel

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

llvm-svn: 276049
2016-07-19 23:07:03 +00:00
Eric Fiselier d05b10ab4f Fix undefined behavior in __tree
Summary:
This patch attempts to fix the undefined behavior in __tree by changing the node pointer types used throughout. The pointer types are changed for raw pointers in the current ABI and for fancy pointers in ABI V2 (since the fancy pointer types may not be ABI compatible).

The UB in `__tree` arises because tree downcasts the embedded end node and then deferences that pointer. Currently there are 3 node types in __tree.

* `__tree_end_node` which contains the `__left_` pointer. This node is embedded within the container.
* `__tree_node_base` which contains `__right_`, `__parent_` and `__is_black`. This node is used throughout the tree rebalancing algorithms.
* `__tree_node` which contains `__value_`.

Currently `__tree` stores the start of the tree, `__begin_node_`, as a pointer to a `__tree_node`. Additionally the iterators store their position as a pointer to a `__tree_node`. In both of these cases the pointee can be the end node. This is fixed by changing them to store `__tree_end_node` pointers instead.

To make this change I introduced an `__iter_pointer` typedef which is defined to be a pointer to either `__tree_end_node` in the new ABI or `__tree_node` in the current one.
Both `__tree::__begin_node_` and iterator pointers are now stored as `__iter_pointers`.

The other situation where `__tree_end_node` is stored as the wrong type is in `__tree_node_base::__parent_`.  Currently `__left_`, `__right_`, and `__parent_` are all `__tree_node_base` pointers. Since the end node will only be stored in `__parent_` the fix is to change `__parent_` to be a pointer to `__tree_end_node`.

To make this change I introduced a `__parent_pointer` typedef which is defined to be a pointer to either `__tree_end_node` in the new ABI or `__tree_node_base` in the current one.

Note that in the new ABI `__iter_pointer` and `__parent_pointer` are the same type (but not in the old one). The confusion between these two types is unfortunate but it was the best solution I could come up with that maintains the ABI.

The typedef changes force a ton of explicit type casts to correct pointer types and to make current code compatible with both the old and new pointer typedefs. This is the bulk of the change and it's really messy. Unfortunately I don't know how to avoid it.

Please let me know what you think.





Reviewers: howard.hinnant, mclow.lists

Subscribers: howard.hinnant, bbannier, cfe-commits

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

llvm-svn: 276003
2016-07-19 17:56:20 +00:00
Marshall Clow 258a651f3a Bump version # to 4.0.0
llvm-svn: 275904
2016-07-18 20:27:19 +00:00
Marshall Clow 816739ca82 Don't use pthread initializers in constexpr constructors. Patch by elram. Reviewed at https://reviews.llvm.org/D21637.
llvm-svn: 275819
2016-07-18 17:23:06 +00:00
Marshall Clow 2ee837256a Change a couple ifdefs from '#if __cplusplus >= 2011xxx' to '#ifndef _LIBCPP_CXX03_LANG'. No functionality change.
llvm-svn: 275787
2016-07-18 13:19:00 +00:00
Eric Fiselier 197228927a Remove locale tests that depend on enviroment variables.
Constructing a std::locale object from an empty string selects the language
from the current environment variables. If the environment variables name
a locale that doesn't exist, or isn't installed, then the construction of
facets using that locale may throw.

This patch removes tests that use 'std::locale l("")'.

The optimal solution would be to manually set the environment variables
in the test. Unfortunately there is no portable way to do this.

llvm-svn: 275772
2016-07-18 06:15:55 +00:00
Jonas Hahnfeld 16be8ee1ff [libcxx][filesystem] Remove setgid from parent before testing permissions
man page for mkdir says: "If the parent directory has the set-group-ID bit set,
then so will the newly created directory."

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

llvm-svn: 275760
2016-07-18 06:06:50 +00:00
Eric Fiselier a23470efe7 Rework libatomic handling in CMake and LIT.
This patch updates the way libc++ handles checking for libatomic, in part
to prepare for https://reviews.llvm.org/D22073.

Changes:
* 'LIBCXX_HAS_ATOMIC_LIB' is now set whenever libatomic is available even libc++
   doesn't need to manually link it.
* 'LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB' is now used to detect when libatomic
   needs to be manually linked.
* 'LIBCXX_HAS_ATOMIC_LIB' now adds 'libatomic' as a available feature in the
   test suite.

llvm-svn: 275759
2016-07-18 06:01:50 +00:00
Eric Fiselier 826f17399b Improve ABI tests for std::pair.
llvm-svn: 275757
2016-07-18 04:48:37 +00:00
Eric Fiselier fb946da259 Add checkpoint diagnostics to help diagnose buildbot failures.
llvm-svn: 275754
2016-07-18 03:00:09 +00:00
Eric Fiselier 03f46fc2ed Prevent failures by marking Clock::is_steady tests as UNSUPPORTED: asan.
llvm-svn: 275753
2016-07-18 02:29:33 +00:00
Eric Fiselier ec0a4c9946 Add includes in test. Patch from STL@microsoft.com
llvm-svn: 275751
2016-07-18 02:05:31 +00:00