Commit Graph

3424 Commits

Author SHA1 Message Date
Eric Fiselier 2371589266 Implement LWG 2770 - Make tuple_size<T> defined for all T
llvm-svn: 286779
2016-11-13 20:43:50 +00:00
Eric Fiselier 40905833b5 Fix PR30979 - tuple<move_only> is constructible from move_only const&
llvm-svn: 286774
2016-11-13 19:54:31 +00:00
Roger Ferrer Ibanez aee391b535 Protect bitset tests under libcpp-no-exceptions
Bitset tests feature a sequence of tests of increasing bitset sizes,
but these tests rely on exceptions when the bitset size is less than
50 elements.

This change adds a flag to tell whether a test should throw. If it must
throw it will be skipped under no-exceptions.

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

llvm-svn: 286474
2016-11-10 16:54:55 +00:00
Petr Hosek 260952ed1a [CMake] Check runtimes subdir when looking for libcxxabi
The runtimes subdir is the new location for runtimes, we should
include it when looking for libcxxabi headers.

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

llvm-svn: 286333
2016-11-09 03:22:28 +00:00
Shoaib Meenai 76728d88ec [libc++] Remove unnecessary MSVCRT exclusions
Visual Studio 2013 and up have these functions, and we don't need to
support older versions.

There are some remaining _LIBCPP_MSVCRT exclusions which are present on
Visual Studio 2015 but not 2013. Those will be addressed in a follow-up.

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

llvm-svn: 286202
2016-11-08 03:31:42 +00:00
Roger Ferrer Ibanez a5672e0c4b Protect std::experimental::optional tests under libcpp-no-exceptions
In these tests there are some paths that explicitly throw, so use
the TEST_THROW macro that was proposed for this and then skip the tests
that may enter the throwing path.

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

llvm-svn: 286099
2016-11-07 08:23:59 +00:00
Eric Fiselier fbc9ff244c Upgrade in-tree google benchmark to v1.1
llvm-svn: 286029
2016-11-05 00:30:27 +00:00
Stephan T. Lavavej 0f901c7ec4 [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.
This replaces every occurrence of _LIBCPP_STD_VER in the tests with
TEST_STD_VER. Additionally, for every affected
file, #include "test_macros.h" is being added explicitly if it wasn't
already there.

https://reviews.llvm.org/D26294

llvm-svn: 286007
2016-11-04 20:26:59 +00:00
Marshall Clow 720ef47200 Implement another part of P0031; adding constexpr to move_iterator
llvm-svn: 285818
2016-11-02 15:30:26 +00:00
Roger Ferrer Ibanez 50e59f3b60 Remove spurious token from #endif
llvm-svn: 285792
2016-11-02 08:36:43 +00:00
Roger Ferrer Ibanez 8c6562398e Protect tests for new/delete under libcpp-no-exceptions
Skip the tests that expect an exception be thrown and protect unreachable catch blocks.

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

llvm-svn: 285791
2016-11-02 08:14:57 +00:00
Eric Fiselier 5fd26e13da Fix GCC test failure caused by manually defining _LIBCPP_HAS_NO_VARIADICS
llvm-svn: 285788
2016-11-02 05:08:58 +00:00
Eric Fiselier 0b460e6bf8 Fix __libcpp_is_constructible for source types with explicit conversion operators.
Previously __libcpp_is_constructible checked the validity of reference
construction using 'eat<To>(declval<From>())' but this doesn't consider
From's explicit conversion operators. This patch teaches __libcpp_is_constructible
how to handle these cases. To do this we need to check the validity
using 'static_cast<To>(declval<From>())'. Unfortunately static_cast allows
additional base-to-derived and lvalue-to-rvalue conversions, which have to be
checked for and manually rejected.

While implementing these changes I discovered that Clang incorrectly
rejects `static_cast<int&&>(declval<float&>())` even though
`int &&X(declval<float&>())` is well formed. In order to tolerate this bug
the `__eat<T>(...)` needs to be left in-place. Otherwise it could be replaced
entirely with the new static_cast implementation.

Thanks to Walter Brown for providing the test cases.

llvm-svn: 285786
2016-11-02 03:57:34 +00:00
Roger Ferrer Ibanez 8a915ed644 Protect exceptional paths under libcpp-no-exceptions
These tests are of the form

try {
   action-that-may-throw
   assert(!exceptional-condition)
   assert(some-other-facts)
 } catch (relevant-exception) {
   assert(exceptional-condition)
 }

Under libcpp-no-exceptions there is still value in verifying
some-other-facts while avoiding the exceptional case. So for these tests
just conditionally check some-other-facts if exceptional-condition is
false. When exception are supported make sure that a true
exceptional-condition throws an exception

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

llvm-svn: 285697
2016-11-01 15:46:16 +00:00
Roger Ferrer Ibanez 60d6ef63a4 Protect lock tests under libcpp-no-exceptions
Skip tests that expect an exception to be thrown.

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

llvm-svn: 285695
2016-11-01 15:00:16 +00:00
Roger Ferrer Ibanez 8cba0befb4 Protect tests that expect an exception for an unknown std::random_device
Skip these tests under libcpp-no-exceptions.

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

llvm-svn: 285677
2016-11-01 08:11:12 +00:00
Shoaib Meenai 73aa38dfb3 [libc++] Add configuration define for off_t functions
Create this define in __config and use it elsewhere, instead of checking
the operating system/library defines in other files. The aim is to
reduce the usage of _WIN32 outside __config. No functional change.

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

llvm-svn: 285582
2016-10-31 15:09:10 +00:00
Roger Ferrer Ibanez c6a40d24d0 Fix archetypes.hpp under libcpp-no-extensions and std level < 14
Under -fno-exceptions TEST_THROW becomes abort / __builtin_abort which returns
void. This causes a type mismatch in the conditional operator when testing the
library in C++98,03,11 modes.

Use a comma operator to workaround this problem.

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

llvm-svn: 285572
2016-10-31 14:14:13 +00:00
Roger Ferrer Ibanez 3565c96d86 Change from "XFAIL: libcpp-no-exceptions" to "UNSUPPORTED: libcpp-no-exceptions" tests that only check exceptions and nothing else
This is a follow up of D24562.

These tests do not check anything but exceptions, so it makes sense to mark
them as UNSUPPORTED under a library built without exceptions.

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

llvm-svn: 285550
2016-10-31 08:47:53 +00:00
Eric Fiselier ebcc86e469 Add 'inline' but not 'always_inline' to std::strings destructor.
Adding both 'inline' and 'always_inline' to the destructor has been contentious.
However most of the performance benefits can be gained by only adding 'inline',
and there is no reason to hold up that change while discussing the other.

llvm-svn: 285538
2016-10-31 03:42:50 +00:00
Eric Fiselier 0f0a077c89 Remove additional function template definitions from the dylib
llvm-svn: 285537
2016-10-31 03:40:29 +00:00
Eric Fiselier a55333003d Optimize filesystem::path by providing weaker exception guarantees.
path uses string::append to construct, append, and concatenate paths. Unfortunatly
string::append has a strong exception safety guaranteed and if it can't prove
that the iterator operations don't throw then it will allocate a temporary
string copy to append to. However this extra allocation and copy is very
undesirable for path which doesn't have the same exception guarantees.

To work around this this patch adds string::__append_forward_unsafe which exposes
the std::string::append interface for forward iterators without enforcing
that the iterator is noexcept.

llvm-svn: 285532
2016-10-31 02:46:25 +00:00
Eric Fiselier 7ca76565e7 Fix _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY to always have default visibility.
This prevent the symbols from being both externally available and hidden, which
causes them to be linked incorrectly. This is only a problem when the address
of the function is explicitly taken since it will always be inlined otherwise.

This patch fixes the issues that caused r285456 to be reverted, and can
now be reapplied.

llvm-svn: 285531
2016-10-31 02:07:23 +00:00
Eric Fiselier ef915d3ef4 Improve performance of constructing filesystem::path from strings.
This patch fixes a performance bug when constructing or appending to a path
from a string or c-string. Previously we called 'push_back' to append every
single character. This caused multiple re-allocation and copies when at most
one reallocation is necessary. The new behavior is to simply call
`string::append` so it can correctly handle reallocation.

For large strings this change is a ~4x improvement. This also makes our path
faster to construct than libstdc++'s.

llvm-svn: 285530
2016-10-30 23:53:50 +00:00
Eric Fiselier 1467a197e5 Rewrite std::filesystem::path iterators and parser
This patch entirely rewrites the parsing logic for paths. Unlike the previous
implementation this one stores information about the current state; For example
if we are in a trailing separator or a root separator. This avoids the need for
extra lookahead (and extra work) when incrementing or decrementing an iterator.
Roughly this gives us a 15% speedup over the previous implementation.

Unfortunately this implementation is still a lot slower than libstdc++'s.
Because libstdc++ pre-parses and splits the path upon construction their
iterators are trivial to increment/decrement. This makes libc++ lazy parsing
100x slower than libstdc++. However the pre-parsing libstdc++ causes a ton
of extra and unneeded allocations when constructing the string. For example
`path("/foo/bar/")` would require at least 5 allocations with libstdc++
whereas libc++ uses only one. The non-allocating behavior is much preferable
when you consider filesystem usages like 'exists("/foo/bar/")'.

Even then libc++'s path seems to be twice as slow to simply construct compared
to libstdc++. More investigation is needed about this.

llvm-svn: 285526
2016-10-30 23:30:38 +00:00
Eric Fiselier 3aa5478e21 Add start of filesystem benchmarks
llvm-svn: 285524
2016-10-30 22:53:00 +00:00
Mehdi Amini 31fdcf39d3 Revert "Added 'inline' attribute to basic_string's destructor"
This reverts commit r285456, which broke LTO bootstrap on Darwin.

llvm-svn: 285485
2016-10-29 00:50:02 +00:00
Eric Fiselier d03a5ffcf6 Remove files missed in r285466
llvm-svn: 285469
2016-10-28 22:54:24 +00:00
Eric Fiselier 0c3b87d925 Revert addition of __libcpp_library_version
llvm-svn: 285466
2016-10-28 22:37:24 +00:00
Aditya Kumar 825078184c Added 'inline' attribute to basic_string's destructor
Author: laxmansole

Reviewers: howard.hinnant
           mclow.lists
Subscribers: EricWF, flyingforyou, evandro

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

Reapplying the patch as the bug https://llvm.org/bugs/show_bug.cgi?id=30341 is fixed.

Currently basic_string's destructor is not getting inlined. So adding 'inline' attribute to ~basic_string().
Worked in collaboration with Aditya Kumar.

llvm-svn: 285456
2016-10-28 21:27:24 +00:00
Eric Fiselier a9272314b9 Fix Clang 3.6 build error
llvm-svn: 285445
2016-10-28 20:19:36 +00:00
Eric Fiselier 57fd64b9f0 Try 2 to add extern C++ to __libcpp_library_version
llvm-svn: 285427
2016-10-28 18:26:06 +00:00
Eric Fiselier 5b17158096 Explicitly specify extern "C++" on __libcpp_library_version
llvm-svn: 285403
2016-10-28 15:02:30 +00:00
Eric Fiselier a32a961b10 Fix test when using an installed libc++
llvm-svn: 285392
2016-10-28 11:01:12 +00:00
Eric Fiselier 64428acf41 Add more tests for optional<const T>
llvm-svn: 285384
2016-10-28 06:40:29 +00:00
Eric Fiselier 53091bf361 Update mac ABI list
llvm-svn: 285383
2016-10-28 06:09:44 +00:00
Eric Fiselier 761e42fa3d Add __libcpp_version file and __libcpp_library_version function.
This patch does two seperate things. First it adds a file called
"__libcpp_version" which only contains the current libc++ version
(currently 4000). This file is not intended for use as a header. This file
is used by Clang in order to easily determine the installed libc++ version.
This allows Clang to enable/disable certain language features only when the
library supports them.

The second change is the addition of _LIBCPP_LIBRARY_VERSION macro, which
returns the version of the installed dylib since it may be different than
the headers.

llvm-svn: 285382
2016-10-28 06:06:50 +00:00
Tim Shen e776667441 [libcxx] Make regex_match backtrack when search fails
Summary:
Fixes PR19851.
alg.re.match/ecma.pass.cpp still XFAILS on linux, but after commenting out
locale-related tests, it passes. I don't have a freebsd machine to produce a
full pass.

Reviewers: mclow.lists

Subscribers: cfe-commits, emaste

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

llvm-svn: 285352
2016-10-27 21:40:34 +00:00
Stephan T. Lavavej 50b80c36fa [PATCH] D25483: [libcxx] [test] Fix non-Standard assumptions about how many elements are allocated
llvm-svn: 285346
2016-10-27 21:25:12 +00:00
Marshall Clow d4cd37faca Move 'quoted' for string_view from <string_view> to <iomanip> (where the other versions of 'quoted' live. No functional change.
llvm-svn: 285300
2016-10-27 15:10:07 +00:00
Casey Carter be65b24a55 Cleanup nonportable behavior in tests for std::any
Fixes MS issues 63, 64, and 65.

test/std/utilities/any/any.class/any.cons/move.pass.cpp:
* "Moves are always destructive" is not a portable assumption; check with LIBCPP_ASSERT.

test/std/utilities/any/any.class/any.cons/value.pass.cpp:
* The standard does not forbid initializing std::any from any pointer-to-function type. Remove the non-conforming "DecayTag" test.

test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp:
* Self-swap is not specified to perform no moves; check with LIBCPP_ASSERT.

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

llvm-svn: 285234
2016-10-26 20:18:13 +00:00
Casey Carter 9450d5e262 Silence unused parameter warnings in archetypes.hpp
Reviewed at: https://reviews.llvm.org/D25958

llvm-svn: 285213
2016-10-26 17:22:25 +00:00
Eric Fiselier 8f29ea36c3 Fix nullptr tests
llvm-svn: 285117
2016-10-25 20:45:17 +00:00
Eric Fiselier 18f5baec5a Update revision number in CHANGELOG.TXT
llvm-svn: 285102
2016-10-25 19:44:38 +00:00
Eric Fiselier 10b12f05d4 [libcxx] Build with -fvisibility-inlines-hidden -- Remove 20 inline definitions from the dylib
Summary:
This patch turns on `-fvisibility-inlines-hidden` when building  the dylib. This is important so that libc++.dylib doesn't accidentally export inline-functions which are ODR used somewhere in the dylib.

On OS X this change has no effect on the current ABI of the dylib. Unfortunately on Linux there are already ~20 inline functions which are unintentionally exported by the dylib. Almost all of these are implicitly generated destructors. I believe removing these function definitions is safe because every "linkage unit" which uses these functions has its own definition, and therefore shouldn't be dependent on libc++.dylib to provide them.

Also could a FreeBSD maintainer comment on the ABI compatibility of this patch?



Reviewers: mclow.lists, emaste, dexonsmith, joker-eph-DISABLED, jroelofs, danalbert, mehdi_amini, compnerd, dim

Subscribers: beanz, mgorny, cfe-commits, modocache

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

llvm-svn: 285101
2016-10-25 19:43:44 +00:00
Eric Fiselier a624409cb5 [libc++] Fix modules build - Rework __refstring definition
Summary:
`__libcpp_refstring` currently has two different definitions. First there is the complete definition in `<__refstring>` but there is also a second in  `<stdexcept>`.  The historical reason for this split is because both libc++ and libc++abi need to see the inline definitions of __libcpp_refstrings methods, but the `<stdexcept>` header doesn't.  However this is an ODR violation and breaks the modules build.

This patch fixes the issue by creating a single class definition in `<stdexcept>` and changing `<__refstring>` to contain only the inline method definitions. This way both `libcxx/src/stdexcept.cpp` and `libcxxabi/src/stdexcept.cpp` see the same declaration in `<stdexcept>` and definitions in `<__refstring>`

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 285100
2016-10-25 19:33:14 +00:00
Eric Fiselier a905007f12 Fix non-portable tests for temp_directory_path(...)
llvm-svn: 285020
2016-10-24 20:40:35 +00:00
Eric Fiselier 4d4c79d8f5 Add missing include in string_view tests. Patch from Billy ONeil @ microsoft
llvm-svn: 285012
2016-10-24 20:11:17 +00:00
Eric Fiselier 009fb08d14 Fix shadow warnings in string_view tests. Patch from STL@microsoft.com
llvm-svn: 285011
2016-10-24 20:10:00 +00:00
Eric Fiselier d11fdad33e Backout enabling -Wshadow until I have time to fix the breakage
llvm-svn: 284952
2016-10-23 22:24:11 +00:00
Petr Hosek 642b5b27fe [libcxx] Use C++14 when building libc++ with musl
musl's pthread implementations use volatile types in their structs
which is not being constexpr in C++11 but is in C++14.

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

llvm-svn: 284950
2016-10-23 21:48:27 +00:00
Eric Fiselier 878e7e2ff6 Fix breakage introduced by adding -Wshadow.
llvm-svn: 284946
2016-10-23 19:26:39 +00:00
Eric Fiselier 81a09f2c9e Fix libc++ specific assertion in permissions(...) tests
llvm-svn: 284945
2016-10-23 19:14:58 +00:00
Eric Fiselier b51325cefe Turn on -Wshadow so I find occurances before STL does
llvm-svn: 284944
2016-10-23 19:01:10 +00:00
Eric Fiselier 1e96d5380e Make make_from_tuple tests more portable. Patch from STL@microsoft.com
llvm-svn: 284943
2016-10-23 18:55:51 +00:00
Eric Fiselier eca753ad92 Fix unreferenced parameters. Patch from STL@microsoft.com
llvm-svn: 284942
2016-10-23 18:52:58 +00:00
Eric Fiselier d06ee7706c Fix shadowing warning. Patch from STL@microsoft.com
llvm-svn: 284941
2016-10-23 18:47:58 +00:00
Tim Shen abd1a6e687 [libcxx] Support std::regex_constants::match_not_null
Summary: Fixes PR21597.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 284881
2016-10-21 20:41:47 +00:00
Bruno Cardoso Lopes 81440dc93f [ModuleMap] Add more module entries to cover some non modular headers
These modules are necessary on Darwin to allow modules with
'no_undeclared_includes' (introduced in clang r284797) to work properly
while using libc++ headers.

Patch extracted from a suggested module.modulemap from Richard Smith!

llvm-svn: 284801
2016-10-21 03:14:27 +00:00
Marshall Clow c1b73a1793 Adding a missing constexpr test for reverse_iterator operator[].
llvm-svn: 284731
2016-10-20 14:57:34 +00:00
Eric Fiselier db94496629 Attempt to workaround XPASS for aligned allocation tests
llvm-svn: 284691
2016-10-20 03:31:07 +00:00
Marshall Clow 1b8f260ed9 Implement constexpr support for reverse_iterator. Reviewed as https://reviews.llvm.org/D25534
llvm-svn: 284602
2016-10-19 15:12:50 +00:00
Michal Gorny 7c3e4ebd92 [cmake] Allow testing against installed LLVM with no sources
Adjust the stand-alone build files to accept either CMake files from
LLVM_CMAKE_PATH or from LLVM_MAIN_SRC_DIR instead of requiring both.
This makes it possible to run libcxx tests on top of installed LLVM
and lit, without having to unpack a copy of LLVM sources. Furthermore,
it avoids adding duplicate paths.

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

llvm-svn: 284583
2016-10-19 12:34:17 +00:00
Michal Gorny ef634ecddd [solaris] Convert the support library to C++ to fix -std=c++11 build
Convert the Solaris xlocale.c compatibility library from plain C to C++
in order to fix the build failures caused by the addition of -std=c++11
to LIBCXX_COMPILE_FLAGS. The additional flag got propagated to the C
file, resulting in error with strict compilers.

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

llvm-svn: 284494
2016-10-18 16:54:59 +00:00
Michal Gorny 376548c34c [solaris] Fix iswxdigit_l() support function prototype
Fix the iswxdigit_l() function prototype to take wint_t parameter
instead of incorrect wchar_t.

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

llvm-svn: 284493
2016-10-18 16:54:54 +00:00
Eric Fiselier c5777f4d58 Make any_cast<void()>(nullptr) compile
llvm-svn: 284333
2016-10-16 11:56:38 +00:00
Eric Fiselier 9db689263e Update LWG 2754 status
llvm-svn: 284326
2016-10-16 03:52:48 +00:00
Eric Fiselier f9c7310e7a Fix use of non-constexpr C++14 addressof
llvm-svn: 284325
2016-10-16 03:49:18 +00:00
Eric Fiselier f72aaff994 Update LWG 2767 and add test case
llvm-svn: 284324
2016-10-16 03:45:06 +00:00
Eric Fiselier 015fcffd57 Update status for std::optional LWG issues and fix an optional SFINAE bug
llvm-svn: 284323
2016-10-16 03:21:35 +00:00
Eric Fiselier 50253ed1c6 Update issue status for LWG 2744
llvm-svn: 284322
2016-10-16 02:51:50 +00:00
Eric Fiselier 9c737fddba Update issue status for LWG 2768 and 2769
llvm-svn: 284321
2016-10-16 01:43:43 +00:00
Eric Fiselier a296b7bf12 Update notes for LWG 2678
llvm-svn: 284319
2016-10-16 00:49:33 +00:00
Eric Fiselier ecafa8739e Implement LWG 2712 and update other issues status
llvm-svn: 284318
2016-10-16 00:47:59 +00:00
Eric Fiselier ae4c3e1699 Implement LWG 2681 and 2682
llvm-svn: 284316
2016-10-16 00:29:22 +00:00
Eric Fiselier 736538b0fc Mark LWG 2680 as done
llvm-svn: 284315
2016-10-15 23:12:30 +00:00
Eric Fiselier 9ada18b339 Implement LWG 2672.
llvm-svn: 284314
2016-10-15 23:05:04 +00:00
Eric Fiselier 87ee8a0adb Implement modified LWG 2665
llvm-svn: 284313
2016-10-15 22:37:42 +00:00
Eric Fiselier bbcfec7edd Implement LWG2664 and update its status
llvm-svn: 284310
2016-10-15 21:29:44 +00:00
Eric Fiselier 26ef119dcb Update the status of issues
llvm-svn: 284309
2016-10-15 20:58:51 +00:00
Eric Fiselier d2003575ce Prevent new/delete replacement tests from being optimized away.
llvm-svn: 284289
2016-10-14 22:47:08 +00:00
Eric Fiselier 797cb4f646 Clarify XFAIL comments
llvm-svn: 284282
2016-10-14 21:30:35 +00:00
Asiri Rathnayake 3cf2f7bca9 [libcxx] Improve the gcc workaround for the missing __has_include macro.
NFC.

llvm-svn: 284237
2016-10-14 13:56:58 +00:00
Asiri Rathnayake 81c0be3f56 [libcxx] Do not declare the thread api when __external_threading is present
This fixes a small omission where even when __external_threading is provided,
we attempt to declare a pthread based threading API. Instead, we should leave
out everything for the __external_threading header to take care of.

The __threading_support header provides a proof-of-concept externally threaded
libc++ variant when _LIBCPP_HAS_THREAD_API_EXTERNAL is defined. But if the
__external_threading header is present, we should exclude all of that POC stuff.

Reviewers: EricWF

Differential revision: https://reviews.llvm.org/D25468

llvm-svn: 284232
2016-10-14 13:00:07 +00:00
Eric Fiselier 194e027f4c Disable Modules when building the libc++ sources.
Libc++ will not build with modules enabled. In order to support an in-tree
libc++ when LLVM_ENABLE_MODULES is ON we need to explicitly disable the feature.

Unfortunately the libc++ sources are fundamentally non-modular. For example
iostream.cpp defines cout, cerr, wout, ... as char buffers instead of streams
in order to better control initialization/destruction. Not shockingly Clang
diagnoses this. Many other sources files define _LIBCPP_BUILDING_FOO macros to
provide definitions for normally inline symbols (See bind.cpp). Finally The
current module.map prohibits using <strstream> in C++11 so we can't build
strstream.cpp.

I think I can fix most of these issues but until then just disable modules.

llvm-svn: 284230
2016-10-14 12:56:52 +00:00
Eric Fiselier 68696836d1 Work around Clang driver segfault when --coverage is used with -c and /dev/null
llvm-svn: 284225
2016-10-14 10:30:33 +00:00
Eric Fiselier 9a7c3e56fd Remove dead CMake target
llvm-svn: 284216
2016-10-14 09:06:38 +00:00
Eric Fiselier 81b13934c1 XFAIL aligned allocation tests for older Clang versions
llvm-svn: 284214
2016-10-14 08:47:09 +00:00
Eric Fiselier 73bfe423fe XFAIL aligned allocation test failures with UBSAN
llvm-svn: 284210
2016-10-14 07:49:15 +00:00
Eric Fiselier 498ee00a3a Add void_t and invoke feature test macros
llvm-svn: 284209
2016-10-14 07:19:52 +00:00
Eric Fiselier ffb602125a Update OS X ABI list
llvm-svn: 284208
2016-10-14 06:49:30 +00:00
Eric Fiselier 831a86a191 Correct ABI changelog revision number
llvm-svn: 284207
2016-10-14 06:47:37 +00:00
Eric Fiselier 0ae4f23fdc Implement P0035R4 -- Add C++17 aligned allocation functions
Summary:
This patch implements the library side of P0035R4. The implementation is thanks to @rsmith.

In addition to the C++17 implementation, the library implementation can be explicitly turned on using `-faligned-allocation` in all dialects.


Reviewers: mclow.lists, rsmith

Subscribers: rsmith, cfe-commits

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

llvm-svn: 284206
2016-10-14 06:46:30 +00:00
Eric Fiselier d2c29f9c54 Cleanup LIT testing doc
llvm-svn: 284205
2016-10-14 06:15:27 +00:00
Eric Fiselier 35355bb896 Remove two ABI symbols added after the 3.9 release
llvm-svn: 284200
2016-10-14 05:29:46 +00:00
Eric Fiselier 5182ba5a9f Add ABI changelog entry for <any>
llvm-svn: 284199
2016-10-14 05:10:06 +00:00
Eric Fiselier 505233b966 Sort ABI lists by name so that changes don't generate big diffs
llvm-svn: 284198
2016-10-14 05:04:00 +00:00
Eric Fiselier e9c4ddbfb5 Revert r284193 - it is not correct on OS X
llvm-svn: 284194
2016-10-14 04:21:24 +00:00
Eric Fiselier 94b5f18fa4 Re-export two previously exported std::string functions.
These functions were removed from the dylib sometime between the 3.9 release
and now. This patch manually exports them to re-gain ABI compatibility.

llvm-svn: 284193
2016-10-14 04:14:24 +00:00
Eric Fiselier 43e72f5ee6 Add ABI list for 3.9 linux
llvm-svn: 284192
2016-10-14 04:06:19 +00:00
Eric Fiselier e58b4672ad Add 3.9 symbol list for OS X
llvm-svn: 284189
2016-10-14 02:55:43 +00:00
Eric Fiselier 5efb3093a5 Fix CMake configuration error and add ABI lists for OS X.
The primary reason for this patch is to add the OS X ABI lists for 3.9 and
ToT.

However while working on that I discovered that we incorrectly
exported the libc++abi symbols. Previously we had chosen the wrong CMake
configuration path and that caused us to re-export the c++abi binary instead
of using the symbol lists.

llvm-svn: 284188
2016-10-14 02:55:19 +00:00
Eric Fiselier 4d968d356f Add OS X abi list
llvm-svn: 284186
2016-10-14 02:32:54 +00:00
Eric Fiselier 78659cdf47 Add ABI Changelog and current symbol list for Linux
llvm-svn: 284185
2016-10-14 02:27:44 +00:00
Sebastian Pop 622c26389f remove warnings from google-benchmarks in libcxx
Differential Revision: https://reviews.llvm.org/D25522

Patch written by Aditya Kumar.

llvm-svn: 284179
2016-10-14 00:07:57 +00:00
Marshall Clow 3baae885e1 Update the status of three papers that do not require library changes
llvm-svn: 284165
2016-10-13 21:15:09 +00:00
Marshall Clow 6ecac73019 Implement http://wg21.link/p0302r1: Removing Allocator Support in std::function. These functions never worked, and as far as I know, no one ever called them.
llvm-svn: 284164
2016-10-13 21:06:03 +00:00
Marshall Clow bb1db210a8 Add missing include in test; NFC. Thanks to Jonathan Wakely for the report.
llvm-svn: 284120
2016-10-13 13:21:38 +00:00
Eric Fiselier 5e198da869 Revert r282345 - Use __attribute__((internal_linkage)) when available.
llvm-svn: 284101
2016-10-13 04:07:58 +00:00
Dimitry Andric ca2ab4f657 Disable trivial pair copy/move tests when unsupported
Summary:
On FreeBSD, for ABI compatibility reasons, the pair trivial copy
constructor is disabled, using the aptly-named
`_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR` define.

Disable the related tests when this define is on, so they don't fail
unexpectedly.

Reviewers: emaste, rsmith, theraven, EricWF

Subscribers: cfe-commits

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

llvm-svn: 284047
2016-10-12 20:26:47 +00:00
Marshall Clow 853042cf89 Mark ostream_iterator's constructors as noexcept.
llvm-svn: 284021
2016-10-12 16:13:48 +00:00
Shoaib Meenai 9f50fffc04 [libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS
The behavior of this macro actually needs to apply universally on
Windows and not just when using the Microsoft CRT. Update the macro
definition and documentation accordingly.

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

llvm-svn: 284016
2016-10-12 13:48:14 +00:00
Eric Fiselier a9fcc1d2a4 Correctly grant rebound limited_allocators friendship.
llvm-svn: 284006
2016-10-12 11:35:37 +00:00
Eric Fiselier 609fb0cc40 Remove incorrect XFAILS
llvm-svn: 284005
2016-10-12 11:29:18 +00:00
Eric Fiselier d2c71a923e Unbreak C++03 build
llvm-svn: 284004
2016-10-12 11:20:27 +00:00
Eric Fiselier 6b42540756 Remove usages of _LIBCPP_CONSTEXPR under test/std
llvm-svn: 284002
2016-10-12 10:28:09 +00:00
Eric Fiselier 6ce45e0840 Remove usages of _ALIGNAS_TYPE
llvm-svn: 283999
2016-10-12 10:19:48 +00:00
Eric Fiselier 1b9327f332 support --param=std=gnu++XX
llvm-svn: 283997
2016-10-12 09:53:35 +00:00
Eric Fiselier 1c3203a2c1 Fix more C++11 constexpr issues in the tests
llvm-svn: 283996
2016-10-12 09:48:44 +00:00
Eric Fiselier 883cc25d9f Fix nasty_containers.hpp for other stdlibs
llvm-svn: 283994
2016-10-12 09:31:26 +00:00
Eric Fiselier 9b480b07f9 Fix use of C++14 constexpr in C++11
llvm-svn: 283993
2016-10-12 09:20:58 +00:00
Eric Fiselier 5e931dd232 Remove use of _VSTD::__invoke in the not_fn tests
llvm-svn: 283991
2016-10-12 09:06:12 +00:00
Eric Fiselier 411e1f8288 Protect special members of NullBase archetype to avoid exposing them
llvm-svn: 283983
2016-10-12 08:09:22 +00:00
Eric Fiselier a9e659619f Implement N4606 optional
Summary:
Adapt implementation of Library Fundamentals TS optional into an implementation of N4606 optional.

  - Update relational operators per http://wg21.link/P0307
  - Update to requirements of http://wg21.link/P0032
  - Extension: Implement trivial copy/move construction/assignment for `optional<T>` when `T` is trivially copyable.

Audit P/Rs for optional LWG issues:
  - 2756 "C++ WP optional<T> should 'forward' T's implicit conversions" Implemented, which also resolves 2753 "Optional's constructors and assignments need constraints" (modulo my refusal to explicitly delete the move operations, which is a design error that I'm working on correcting in the 2756 P/R).
  - 2736 "nullopt_t insufficiently constrained" Already conforming. I've added a test ensuring that `nullopt_t` is not copy-initializable from an empty braced-init-list, which I believe is the root intent of the issue, to avoid regression.
  - 2740 "constexpr optional<T>::operator->" Already conforming.
  - 2746 "Inconsistency between requirements for emplace between optional and variant" No P/R, but note that the author's '"suggested resolution" is already implemented.
  - 2748 "swappable traits for optionals" Already conforming.
  - 2753 "Optional's constructors and assignments need constraints" Implemented.

Most of the work for this patch was done by Casey Carter @ Microsoft. Thank you Casey!



Reviewers: mclow.lists, CaseyCarter, EricWF

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

llvm-svn: 283980
2016-10-12 07:46:20 +00:00
Eric Fiselier fc647db3ee Revert Add <optional>. Will recommit with better commit message
llvm-svn: 283978
2016-10-12 06:48:31 +00:00
Eric Fiselier 6ee4001cc9 Add <optional> header.
This patch is largely thanks to Casey Carter @ Microsoft. He did the initial
work of porting our experimental implementation and tests over to namespace
std.

llvm-svn: 283977
2016-10-12 06:45:11 +00:00
Eric Fiselier 49a278fb6d Fix two more tests that hang when testing against libstdc++
llvm-svn: 283976
2016-10-12 04:56:23 +00:00
Eric Fiselier 76e316f995 Prevent the test suite from hanging when run against libstdc++
llvm-svn: 283975
2016-10-12 04:29:50 +00:00
Eric Fiselier e04aebe904 Add mork workarounds for running the test suite against libstdc++
llvm-svn: 283960
2016-10-12 00:28:14 +00:00
Eric Fiselier 612c00df31 Make it easier to run the libc++ test suite against libstdc++
llvm-svn: 283958
2016-10-12 00:00:37 +00:00
Eric Fiselier e6364a35fd Fix LWG2683 - filesystem::copy() should always clear the user-provided error_code
llvm-svn: 283951
2016-10-11 22:18:09 +00:00
Marshall Clow 66e63793e7 Remove extraneous 'const' in the implementation of is_move_assignable. Howard pleads temporary insanity about this. Discussed at http://stackoverflow.com/questions/39986185
llvm-svn: 283945
2016-10-11 21:24:06 +00:00
Eric Fiselier 9595fb21dd Fix std::pair on FreeBSD
Summary:
FreeBSD ships an old ABI for std::pair which requires that it have non-trivial copy/move constructors. Currently the non-trivial copy/move is achieved by providing explicit definitions of the constructors. This is problematic because it means the constructors don't SFINAE properly. In order to SFINAE copy/move constructors they have to be explicitly defaulted and hense non-trivial.

This patch attempts to provide SFINAE'ing copy/move constructors for std::pair while still making them non-trivial. It does this by adding a base class with a non-trivial copy constructor and then allowing pair's constructors to be generated by the compiler. This also allows the constructors to be constexpr.


Reviewers: emaste, theraven, rsmith, dim

Subscribers: cfe-commits

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

llvm-svn: 283944
2016-10-11 21:22:21 +00:00
Eric Fiselier e778d10c0f Fix incorrect exception handling behavior in the uninitialized algorithms
llvm-svn: 283941
2016-10-11 21:13:44 +00:00
Marshall Clow 4bf466bd09 Mark 2777 as complete
llvm-svn: 283804
2016-10-10 21:37:16 +00:00
Marshall Clow e1736760c8 Update with the rest of the results from the 7-Oct Telecom
llvm-svn: 283799
2016-10-10 21:00:12 +00:00
Petr Hosek 50a92304aa [libcxx] Add support for Fuchsia
Fuchsia is a new operating system which uses musl as the standard
C library, libc++ and libc++abi as the C++ standard library.

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

llvm-svn: 283788
2016-10-10 18:53:32 +00:00
Marshall Clow 03344b3bdc Updated notes about issues; marked 2062, 2223, 2394, 2460 and 2540 as complete.
llvm-svn: 283781
2016-10-10 17:11:37 +00:00
Marshall Clow 089d54b540 Add tests to check that swap(std::function, std::function) is noexcept. This is LWG#2062, but we already do this. No changes to the library, just adding tests.
llvm-svn: 283780
2016-10-10 16:47:48 +00:00
Asiri Rathnayake 0c21b40d37 [libcxx] Fix gcc build.
Attempt to fix a horrible gcc include order problem.

llvm-svn: 283762
2016-10-10 15:56:01 +00:00
Eric Fiselier 5df547c28e Fix documentation mis-spelling.
I promise to stop misspelling things when the English language gains a program
that does strict semantic checking.

llvm-svn: 283759
2016-10-10 14:45:06 +00:00
Marshall Clow 8c7365a9fa Add whitespace to make not_fn_impl more clear. NFC.
llvm-svn: 283757
2016-10-10 14:37:18 +00:00
Marshall Clow 33566a711d Mark issues 2544, 2567, 2569, 2686 and 2694 as ready/done.
llvm-svn: 283752
2016-10-10 14:15:56 +00:00
Marshall Clow 610ad3a598 Add tests for LWG2544. We already implement this; just adding tests to make sure that we keep doing it.
llvm-svn: 283749
2016-10-10 14:10:45 +00:00
Asiri Rathnayake 30cd7341d0 [libcxx] Add the missing limits.h header
The implementation of [depr.c.headers] in D12747 introduced the necessary
C headers into libc++. This patch adds one more missing headers: limits.h

We spotted this due to a failing C++03 test [limits_h.pass.cpp] in our libc++
configuration; when the limits.h header is included from a C++ program, it now
bypassed the __config header and went directly into the underlying C library's
limits.h header, which is problematic for us because we use __config header to
configure the underlying C library's behaviour when used from a C++ context.

Reviewers: mclow.lists, rsmith

Differential revision: https://reviews.llvm.org/D25361

llvm-svn: 283726
2016-10-10 08:38:51 +00:00
Eric Fiselier ed84f4abd4 Cleanup CMake status output
llvm-svn: 283721
2016-10-10 06:31:00 +00:00
Eric Fiselier ac473034fc Provide a constexpr addressof with GCC 7.
__builtin_addressof was added to the GCC trunk in the past week. This patch
teaches libc++ about it so it can correctly provide constexpr addressof.

Unfortunately this patch will break users of earlier GCC 7 builds, since
we expect __builtin_addressof but one won't be provided. One option would be
to only use __builtin_addressof for GCC 7.1 and above, but that means
waiting for another release.

Instead I've specifically chosen to break older GCC 7 versions. Since GCC 7
has yet to be released, and the 7.0 release is a development release, I
believe that anybody currently using GCC 7.0 will have no issue upgrading.

llvm-svn: 283715
2016-10-10 05:34:18 +00:00
Eric Fiselier 99b81a59fb Workaround missing C++14 constexpr semantics in filesystem
llvm-svn: 283714
2016-10-10 05:19:59 +00:00
Eric Fiselier a52ce7fd03 Remove use of int128_t inside the filesystem implementation
llvm-svn: 283712
2016-10-10 04:22:58 +00:00
Eric Fiselier 6912539717 Remove debug output from gen_linker_script.py
llvm-svn: 283701
2016-10-09 21:43:30 +00:00
Eric Fiselier 054fc4cef6 Fix linker script generation for in-tree builds
llvm-svn: 283700
2016-10-09 21:34:03 +00:00
Hal Finkel 5b5f4f0c74 [CMake] Fix in-tree libcxxabi build support after r283659
r283659 changed the argument to gen_link_script.py from SCRIPT_ABI_LIBNAME to
LIBCXX_LIBRARIES_PUBLIC, assuming that all of the items in the
LIBCXX_LIBRARIES_PUBLIC list were library names. This is not right, however,
for in-tree libcxxabi builds, we might have the target name in this list. There
was special logic to fixup SCRIPT_ABI_LIBNAME for this situation; change it to
apply a similar fixup for LIBCXX_LIBRARIES_PUBLIC.

llvm-svn: 283684
2016-10-09 02:49:31 +00:00
Michal Gorny 2433b26176 [cmake] Split linked libraries into private & public, for linker script
Introduce LIBCXX_LIBRARIES_PUBLIC in addition to LIBCXX_LIBRARIES that
holds 'public' interface libraries -- that is, libraries that both
libc++ links to and programs linked against it need to link to.

Currently this includes the ABI library and optionally -lunwind (when
LIBCXXABI_USE_LLVM_UNWINDER is on). The libraries are included in the
linker script, in order to make it possible to link C++ programs using
clang with compiler-rt runtime out-of-the-box.

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

llvm-svn: 283659
2016-10-08 10:27:45 +00:00
Eric Fiselier f03ffb2c9b Remove all _LIBCPP_VERSION tests from under test/std
llvm-svn: 283644
2016-10-08 01:32:56 +00:00
Eric Fiselier e58baed3a3 Purge all usages of _LIBCPP_STD_VER under test/std/algorithm
llvm-svn: 283643
2016-10-08 01:25:23 +00:00
Eric Fiselier b10fc37096 Add missing <memory> include in test
llvm-svn: 283633
2016-10-08 00:59:16 +00:00
Eric Fiselier 653179b77b Add missing include in test_allocator.h
llvm-svn: 283632
2016-10-08 00:57:56 +00:00
Eric Fiselier 69a4f66114 [libc++] Fix stack_allocator
Summary:
To quote STL the problems with stack allocator are"

>"stack_allocator<T, N> is seriously nonconformant to N4582 17.6.3.5 [allocator.requirements].
> First, it lacks a rebinding constructor. (The nested "struct rebind" isn't sufficient.)
> Second, it lacks templated equality/inequality.
> Third, it completely ignores alignment.
> Finally, and most severely, the Standard forbids its existence. Allocators are forbidden from returning memory "inside themselves". This requirement is implied by the Standard's requirements for rebinding and equality. It's permitted to return memory from a separate buffer object on the stack, though."

This patch attempts to address all of those issues.

First, instead of storing the buffer inside the allocator I've change `stack_allocator` to accept the buffer as an argument.

Second, in order to fix rebinding I changed the parameter list from `<class T, size_t NumElements>` to `<class T, size_t NumBytes>`. This allows allocator rebinding
between types that have different sizes. 

Third, I added copy and rebinding constructors and assignment operators.

And finally I fixed the allocation logic to always return properly aligned storage.



Reviewers: mclow.lists, howard.hinnant, STL_MSFT

Subscribers: cfe-commits

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

llvm-svn: 283631
2016-10-08 00:56:22 +00:00
Marshall Clow 33b87bffc6 Disable alignment support of 0x4000 for Win32. https://reviews.llvm.org/D25053
llvm-svn: 283621
2016-10-07 23:19:04 +00:00
Eric Fiselier e4d80542d2 Fix PR30642 - libc++ leaks always-visible symbols into programs
This was caused by r281673, specifically changing `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS`
from `__attribute__((__type_visibility__("default")))` to
`__attribute__((__visibility("default")))`.

I made that change because I thought the external instantiations needed
their members to have default visibility. However since libc++ never builds
with -fvisibility=hidden this appears not to be needed. Instead this change
caused previously hidden inline methods to become un-hidden, which is a regression.

This patch reverts the problematic change and fixes PR30642.

llvm-svn: 283620
2016-10-07 23:07:59 +00:00
Eric Fiselier 609e669e1a Fix shadow warnings. Patch from STL@microsoft.com
llvm-svn: 283618
2016-10-07 22:10:35 +00:00
Eric Fiselier b18fd9654f Fix various issues in std::any and the related tests.
* Fix self-swap. Patch from Casey Carter.

* Remove workarounds and tests for types with deleted move constructors. This
  was originally added as part of a LWG proposed resolution that has since
  changed.

* Re-apply most recent PR for LWG 2769.

* Re-apply most recent PR for LWG 2754. Specifically fix the SFINAE checks to
  use the decayed type.

* Fix tests to allow moved-from std::any's to have a non-empty state. This is
  the behavior of MSVC's std::any.

* Various whitespace and test fixes.

llvm-svn: 283606
2016-10-07 21:27:45 +00:00
Eric Fiselier 89c9191447 Remove MSVC workarounds. Patch from STL@microsoft.com
llvm-svn: 283580
2016-10-07 18:51:33 +00:00
Marshall Clow c036604f9b Mark issues 2514, 2519, 2536 and 2475 as done
llvm-svn: 283452
2016-10-06 13:59:18 +00:00
Asiri Rathnayake 08eb2148ff [libcxx] Recover no-exceptions XFAILs - I
First batch of changes to get some of these XFAILs working in the
no-exceptions libc++ variant.

Changed some XFAILs to UNSUPPORTED where the test is all about exception
handling. In other cases, used the test macros TEST_THROW and
TEST_HAS_NO_EXCEPTIONS to conditionally exclude those parts of the test
that concerns exception handling behaviour.

Reviewers: EricWF, mclow.lists

Differential revision: https://reviews.llvm.org/D24562

llvm-svn: 283441
2016-10-06 11:15:41 +00:00
Eric Fiselier ae34c56ee7 Fix strict-aliasing violation in typeinfo::hash_code()
Summary:
The current implementation of `hash_code()` for uniqued RTTI strings violates strict aliasing by dereferencing a type-punned pointer. Specifically it generates a `const char**` pointer from the address of the `__name` member before casting it to `const size_t*` and dereferencing it to get the hash. This is really just a complex and incorrect way of writing `reinterpret_cast<size_t>(__name)`.

This patch changes the conversion sequence so that it no longer contains UB.


Reviewers: howard.hinnant, mclow.lists

Subscribers: rjmccall, cfe-commits

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

llvm-svn: 283408
2016-10-05 22:55:10 +00:00
Marshall Clow 23c725ebdf Comment out failing test while I figure out who is at fault
llvm-svn: 283360
2016-10-05 18:47:18 +00:00
Marshall Clow e81d2fa9bb Mark LWG#2679 as complete
llvm-svn: 283356
2016-10-05 18:36:24 +00:00
Marshall Clow cd1e532c39 Mark LWG#2358 as done
llvm-svn: 283341
2016-10-05 17:02:43 +00:00
Marshall Clow d836a9d5f1 Make tests for is_empty better. No functional change.
llvm-svn: 283339
2016-10-05 17:01:16 +00:00
Marshall Clow 67be6ff839 Add another append test for basic_string
llvm-svn: 283331
2016-10-05 15:47:13 +00:00
Marshall Clow 592024759e Mark LWG issues 2221, 2556 and 2589 as complete
llvm-svn: 283325
2016-10-05 15:21:11 +00:00
Eric Fiselier 015839a555 [libcxx] [test] Guard __has_include usage with a macro
Summary: There's a macro scheme already being used for __has_feature etc. Use it for __has_include too, which makes MSVC happy (it doesn't support __has_include yet, and unguarded use explodes horribly).

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 283260
2016-10-04 21:25:51 +00:00
Marshall Clow af63ab2b69 Mark #2759 as ready and #2755 as complete
llvm-svn: 283222
2016-10-04 14:39:58 +00:00
Marshall Clow 6203c91eac Mark #2598 as ready
llvm-svn: 283220
2016-10-04 14:08:50 +00:00
Marshall Clow f21aa87f3b Mark #2739 as ready
llvm-svn: 283218
2016-10-04 13:41:56 +00:00
Marshall Clow da68203678 Mark a couple more Issaquah issues as done: 2578 and 2738
llvm-svn: 283163
2016-10-03 23:42:31 +00:00
Marshall Clow f2464a9301 Change a couple of 'template <typename's to 'template <class' which is what we use in the rest of the library.
llvm-svn: 283162
2016-10-03 23:40:48 +00:00
Marshall Clow 53abcbd8a9 Add tests to make sure that is_constructible<cv-void> is false. We already checked 'unqualified void'. This was brought up by LWG#2738
llvm-svn: 283161
2016-10-03 23:39:52 +00:00
Marshall Clow a5554a93de Mark a couple issues as done (2742 and 2760)
llvm-svn: 283124
2016-10-03 17:35:08 +00:00
Logan Chien 45e8ba88c3 [lit] Allow more file extensions for test cases.
This commit splits the file extensions before determining the test
format.  This allows libc++abi to add assembly-based test cases.

llvm-svn: 283118
2016-10-03 16:00:22 +00:00
Marshall Clow bfdc374212 Change titie of page from Oulu to Issaquah
llvm-svn: 283113
2016-10-03 14:24:21 +00:00
Marshall Clow a82e92867f List tentatively ready issues for Issaquah
llvm-svn: 283112
2016-10-03 14:23:04 +00:00
Hal Finkel 6f557b9f12 Remove some additional unnecessary std:: in cmath
Unlike in math.h, as Eric pointed out in the review of D18639, we don't need
the std:: in cmath.

llvm-svn: 283052
2016-10-01 20:38:44 +00:00
Hal Finkel ae22f0b242 Use __builtin_isnan/isinf/isfinite in complex
The libc-provided isnan/isinf/isfinite macro implementations are specifically
designed to function correctly, even in the presence of -ffast-math (or, more
specifically, -ffinite-math-only). As such, on most implementation, these
either always turn into external function calls (e.g. glibc) or are
specifically function calls when FINITE_MATH_ONLY is defined (e.g. Darwin).

Our implementation of complex arithmetic makes heavy use of isnan/isinf/isfinite
to deal with corner cases involving non-finite quantities. This was problematic
in two respects:

  1. On systems where these are always function calls (e.g. Linux/glibc), there was a
     performance penalty
  2. When compiling with -ffast-math, there was a significant performance
     penalty (in fact, on Darwin and systems with similar implementations, the code
     may in fact be slower than not using -ffast-math, because the inline
     definitions provided by libc become unavailable to prevent the checks from
     being optimized out).

Eliding these inf/nan checks in -ffast-math mode is consistent with what
happens with libstdc++, and in my experience, what users expect. This is
critical to getting high-performance code when using complex<T>. This change
replaces uses of those functions on basic floating-point types with calls to
__builtin_isnan/isinf/isfinite, which Clang will always expand inline. When
using -ffast-math (or -ffinite-math-only), the optimizer will remove the checks
as expected.

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

llvm-svn: 283051
2016-10-01 20:38:31 +00:00
Eric Fiselier 2c8c71f13e Remove all instances of _LIBCPP_HAS_NO_RVALUE_REFERENCES from test/std/utilities
llvm-svn: 283032
2016-10-01 10:46:01 +00:00
Eric Fiselier f18891050b Replace test_throw.h header with a single test macro
llvm-svn: 283030
2016-10-01 10:34:13 +00:00
Shoaib Meenai c6f93e389e [libc++] Add missing locale aliases
Add underscore aliases for strtof_l and strtod_l. _strtold_l exists in
VS 2013 and above, so fix that definition as a drive-by fix.

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

llvm-svn: 282681
2016-09-29 03:35:41 +00:00
Eric Fiselier 790ad869ac Partially revert overflow checking in last_write_time
llvm-svn: 282660
2016-09-29 01:01:26 +00:00
Shoaib Meenai 3888eb66b0 [libc++] Clarify _LIBCPP_NEW_DELETE_VIS for Windows
Replace a stale reference to cxx_EXPORTS with _LIBCPP_BUILDING_LIBRARY,
and clarify why the operator new and delete family of functions are
marked dllexport when building but *not* dllimport when including the
header externally.

The new code is identical to the intent of the old code (and would be
functionally equivalent were cxx_EXPORTS still defined when building
libc++). The overall behavior is not ideal, since Microsoft's operator
new and delete functions will get called instead of libc++'s, but I
think consistently calling msvcrt's functions is better than either
calling msvcrt's or libc++'s functions depending on header inclusion.

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

llvm-svn: 282644
2016-09-28 22:28:51 +00:00
Eric Fiselier ea117bf9ad Mark libc++ internal globals with _LIBCPP_SAFE_STATIC.
This patch applies the _LIBCPP_SAFE_STATIC attribute to internal globals,
most of which are locking primitives, in order to ensure that they can
safely be used during program startup.

This patch also fixes an unsafe static init issue with the global locks
used to implement atomic operations on shared pointers. Previously the
locks were initialized using a dynamically initialized pointer, so it was
possible that the pointer was uninitialized.

llvm-svn: 282640
2016-09-28 22:08:13 +00:00
Eric Fiselier 09cc08654a Improve 'last_write_time(...)' accuracy and detect overflow errors.
The ::stat struct on Linux, FreeBSD, and OS X  provides the access and
modification times as an instance of 'timespec', which has a nanosecond
resolution. The 'st_mtime' and 'st_atime' members simply reference the 'tv_sec'
value of the timespec struct. This patch changes 'last_write_time(...)' so that
it extracts both the seconds and nanoseconds values of the last modification
time, providing a more accurate implementation of 'last_write_time(...)'.

Additionally this patch fixes a possible signed integer overflow bug. The
'file_time_type' type cannot represent all possible values returned by
the filesystem. Attempting to construct a 'file_time_type' from one of these
values is undefined behavior. This patch avoids that UB by detecting possible
overflows before the conversion.

llvm-svn: 282634
2016-09-28 21:16:58 +00:00
Michal Gorny 0e40bee847 Revert r282483 - [cmake] Add linker option "-Wl,-z,defs" in standalone build
Revert r282483 as it causes build failures due to missing symbols when
not linking to -lgcc_s (i.e. doing pure LLVM stack build). The patch can
be reintroduced when the build system is fixed to add all needed
libraries (libunwind, compiler-rt).

llvm-svn: 282524
2016-09-27 18:54:02 +00:00
Michal Gorny 4601ac04c7 [cmake] Add linker option "-Wl,-z,defs" in standalone build
Add the "-Wl,-z,defs" linker option that is used to prevent
underlinking. It is already used by LLVM itself but does not get
propagated into stand-alone build of libc++. This patch ensures
that the option is passed in independently of whether libc++ is built
in-tree or out-of-tree.

Patch by Lei Zhang.

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

llvm-svn: 282483
2016-09-27 12:15:35 +00:00
Michal Gorny ecc88642d4 [cmake] Strip possibly-inherited compiler flags in in-tree build only
Strip the set of flags (including debug defs, -m32) that could
be inherited from top-level LLVM build only when in-tree build is
performed. This prevents libcxx from confusingly and undesiredly
stripping user-supplied flags e.g. when performing packaging system
controlled multi-ABI build.

Otherwise, in order to perform 32-bit builds the build scripts would
have to use LIBCXX_BUILD_32_BITS. However, -m32 is only one of the many
different ABI flags for different targets, and it really makes no sense
to add separate CMake options for each possible -m* flag and then keep
a mapping from well-known flags to the custom CMake options.

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

llvm-svn: 282475
2016-09-27 07:55:26 +00:00
Eric Fiselier 55089ce834 Fix possible division by zero
llvm-svn: 282468
2016-09-27 02:13:27 +00:00
Eric Fiselier efc962cd06 Remove out of date items in TODO.txt
llvm-svn: 282466
2016-09-27 01:28:47 +00:00
Eric Fiselier 5464421608 Expect DLL builds on Windows by default and require a custom __config for static
builds.

On Windows the __declspec(dllimport) and __declspec(dllexport) attributes
require linking to a DLL, not a static library. Previously these annotations
were disabled by default unless _LIBCPP_DLL was defined. However the DLL
configuration is probably the more common one, so it should be supported by
default.

This patch enables import/export attributes by default and adds a
_LIBCPP_DISABLE_DLL_IMPORT_EXPORT macro which can be used to disable this
behavior. If libc++ is built as a static library on Windows then a custom __config
header will be generated that predefines this macro.

This patch is based off work by Shoaib Meenai.

llvm-svn: 282449
2016-09-26 22:19:41 +00:00
Oleg Ranevskyy eef9b35c6d [libc++] Fix typos causing compilation errors when _LIBCPP_DEBUG_LEVEL >= 2
Summary: This patch fixes a couple of typos that cause compilation errors when application includes <unordered_map> and enables the libc++'s debugging capabilities.

Reviewers: EricWF

Subscribers: llvm-commits

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

llvm-svn: 282446
2016-09-26 21:39:38 +00:00
Eric Fiselier c24e6dd3c8 [libc++] Extension: Make `move` and `forward` constexpr in C++11.
Summary:
`std::move` and `std::forward` were not marked constexpr in C++11.  This can be very damaging because it makes otherwise constant expressions non-constant. For example:

```
#include <utility>
template <class T>
struct Foo {
  constexpr Foo(T&& tx) :  t(std::move(tx)) {}
  T t;
};
[[clang::require_constant_initialization]] Foo<int> f(42); // Foo should be constant initialized but C++11 move is not constexpr. As a result `f` is an unsafe global.
```

This patch applies `constexpr` to `move` and `forward` as an extension in C++11. Normally the library is not allowed to add `constexpr` because it may be observable to the user. In particular adding constexpr may cause valid code to stop compiling. However these problems only happen in more complex situations, like making `__invoke(...)` constexpr. `forward` and `move` are simply enough that applying `constexpr` is safe. 

Note that libstdc++ has offered this extension since at least 4.8.1.

Most of the changes in this patch are simply test cleanups or additions. The main changes in the tests are:

* Fold all `forward_N.fail.cpp` tests into a single `forward.fail.cpp` test using -verify.
* Delete most `move_only_N.fail.cpp` tests because they weren't actually testing anything.
* Fold `move_copy.pass.cpp` and `move_only.pass.cpp` into a single `move.pass.cpp` test.
* Add return type and noexcept tests for `forward` and `move`.




Reviewers: rsmith, mclow.lists, EricWF

Subscribers: K-ballo, loladiro

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

llvm-svn: 282439
2016-09-26 20:55:02 +00:00
Michal Gorny 9eddaeb534 [include] Declare __STDC_*_MACROS for C++11 compat in old libc
Declare __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and
__STDC_CONSTANT_MACROS before including real inttypes.h/stdint.h when
the wrapper-header is included in C++11, in order to enable
the necessary macros in C99-compliant libc.

The C99 standard defined that the format macros in inttypes.h should be
defined by the C++ implementations only when __STDC_FORMAT_MACROS is
defined, and the limit and constant macros in stdint.h should be defined
only when __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are defined
appropriately. Following this specification, multiple old versions of
glibc up to 2.17 do not define those macros by default for C++,
rendering the libc++ headers non-compliant to the C++11 standard.

In order to achieve the necessary compliance, __STDC_FORMAT_MACROS is
defined in wrapped inttypes.h just before including the system
inttypes.h, when C++11 or newer is used. Both __STDC_LIMIT_MACROS
and __STDC_CONSTANT_MACROS are defined in newly-wrapped stdint.h. This
fixes the C++11 compliance while preserving the current behavior for
C++03.

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

llvm-svn: 282435
2016-09-26 20:20:00 +00:00
Eric Fiselier 221f689f3b Update -verify test to use new static assert message
llvm-svn: 282352
2016-09-25 08:30:05 +00:00
Eric Fiselier 4271d0148a Fix missing _LIBCPP_INLINE_VISIBILITY macro on C++03 specific __hash_table function
llvm-svn: 282349
2016-09-25 04:05:46 +00:00
Eric Fiselier 54613ab4d4 [libc++] Remove various C++03 feature test macros
Summary:
Libc++ still uses per-feature configuration macros when configuring for C++11. However libc++ requires a feature-complete C++11 compiler so there is no reason to check individual features. This patch starts the process of removing the feature specific macros and replacing their usage with `_LIBCPP_CXX03_LANG`.

This patch removes the __config macros:

* _LIBCPP_HAS_NO_TRAILING_RETURN
* _LIBCPP_HAS_NO_TEMPLATE_ALIASES
* _LIBCPP_HAS_NO_ADVANCED_SFINAE
* _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
* _LIBCPP_HAS_NO_STATIC_ASSERT

As a drive I also changed our C++03 static_assert to use _Static_assert if available.

I plan to commit this without review if nobody voices an objection.

Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 282347
2016-09-25 03:34:28 +00:00
Eric Fiselier 9e1b0b5b78 Use __attribute__((internal_linkage)) when available.
Summary:
This patch has been a long time coming (Thanks @eugenis). It changes `_LIBCPP_INLINE_VISIBILITY` to use `__attribute__((internal_linkage))` instead of `__attribute__((visibility("hidden"), always_inline))`.

The point of `_LIBCPP_INLINE_VISIBILITY` is to prevent inline functions from being exported from both the libc++ library and from user libraries. This helps libc++ better manage it's ABI.
Previously this was done by forcing inlining and modifying the symbols visibility. However inlining isn't guaranteed and symbol visibility only affects shared libraries making this an imperfect solution.  `internal_linkage` improves this situation by making all symbols local to the TU they are emitted in, regardless of inlining or visibility. IIRC the effect of applying `__attribute__((internal_linkage))` to an inline function is the same as applying `static`.

For more information about the attribute see: http://lists.llvm.org/pipermail/cfe-dev/2015-October/045580.html

Most of the work for this patch was done by @eugenis.


Reviewers: mclow.lists, eugenis

Subscribers: eugenis, cfe-commits

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

llvm-svn: 282345
2016-09-25 03:14:13 +00:00
Marshall Clow a8fd1e4be0 Fix a few static_asserts that need extra parens on -03
llvm-svn: 282343
2016-09-24 23:52:21 +00:00
Marshall Clow 54f0981ebd Implement proposed resolution for LWG#2758. Reviewed as D24446. Normally, I would wait for these to be voted upon at a committee meeting (November), but the current draft standard is broken, and this should fix it. (And if it doesn't, we want to know about it soonest)
llvm-svn: 282342
2016-09-24 22:45:42 +00:00
Marshall Clow 450370f3c8 Fix incorrect include in is_error_code_enum.pass.cpp
llvm-svn: 282332
2016-09-24 18:16:53 +00:00
Marshall Clow e69a08ba6d Implement is_error_code_v and is_error_condition_v for c++17. Rework the tests for is_error_code and is_error_condition, since they were really lacking. Thanks to Alisdair for the heads-up that we were missing these.
llvm-svn: 282331
2016-09-24 17:36:14 +00:00
Shoaib Meenai 4e14445e59 [libc++] Remove math_win32.h
Visual Studio 2013 and onward have all the required functions in their
CRT headers, and we don't support older versions anymore.

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

llvm-svn: 282328
2016-09-24 06:27:28 +00:00
Marshall Clow c669522a26 Fix failure on 03 bot
llvm-svn: 282134
2016-09-22 03:25:22 +00:00
Marshall Clow a48055cee3 Add missing _v traits. is_bind_expression_v, is_placeholder_v and uses_allocator_v
llvm-svn: 282126
2016-09-22 00:23:15 +00:00
Dan Albert bc40821ee3 Fix signatures of fallback tow(upper|lower)_l.
Summary:
These functions take and return wint_t, not int:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/towupper.html

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 281936
2016-09-19 20:42:57 +00:00
Shoaib Meenai 190994e435 [libc++] Fix extern template visibility for Windows
On Windows, marking an `extern template class` declaration as exported
actually forces an instantiation, which is not the desired behavior.
Instead, the actual explicit instantiations need to be exported.

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

llvm-svn: 281925
2016-09-19 18:29:07 +00:00
Dan Albert c991709f46 Replace __ANDROID__ with __BIONIC__.
Summary:
None of these checks are specific to Android devices. If libc++ was
used with Bionic on a normal Linux system these checks would still be
needed.

Reviewers: mclow.lists, EricWF

Subscribers: compnerd, tberghammer, danalbert, srhines, cfe-commits

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

llvm-svn: 281921
2016-09-19 18:00:45 +00:00
Shoaib Meenai 3b33938c05 [libc++] Fix inline attribute for non-MSVC Windows
gcc and clang in gcc compatibility mode do not accept __forceinline. Use
the gcc attribute for them instead.

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

llvm-svn: 281766
2016-09-16 19:12:54 +00:00
Asiri Rathnayake a6199170ac [libcxx] Add missing c++98 xfail. NFC.
This is the only test failing in c++98 mode at the moment.

llvm-svn: 281731
2016-09-16 14:32:19 +00:00
Eric Fiselier 8e68d6a023 Attempt to fix Sphinx build
llvm-svn: 281697
2016-09-16 03:47:53 +00:00
Eric Fiselier 991c354b01 Update _LIBCPP_EXCEPTION_ABI doc with @mclow's feedback
llvm-svn: 281695
2016-09-16 02:51:26 +00:00
Eric Fiselier e0d2d58ff7 Move _LIBCPP_INLINE_VISIBILITY to first declaration in <propagate_const>
llvm-svn: 281692
2016-09-16 02:16:23 +00:00
Eric Fiselier 1e033439ba Move _LIBCPP_INLINE_VISIBILITY to first declaration in sstream.
llvm-svn: 281691
2016-09-16 02:09:26 +00:00
Eric Fiselier 1fbaf535d6 Use _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY in valarray to support attribute((internal_linkage)).
The externally instantiated member functions must be declared using
_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY, not _LIBCPP_INLINE_VISIBILITY, in
order to be properly exported when using __attribute__((internal_linkage)).

Otherwise the explicit instantiations will obviously have internal linkage and
will not be exported from the dylib.

llvm-svn: 281684
2016-09-16 00:13:55 +00:00
Eric Fiselier 1b17a4b7b4 Move inline attributes in filesystem to first declaration
llvm-svn: 281683
2016-09-16 00:07:16 +00:00
Eric Fiselier f8f31c4985 [libc++] Add _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY to support GCC ABI compatibility
Summary:
GCC and Clang handle visibility attributes on the out-of-line definition of externally instantiated templates differently. For example in the reproducer below Clang will emit both 'foo' and 'bar' with default visibility while GCC only emits a non-hidden 'foo'.  

```
// RUN: g++ -std=c++11 -shared -O3 test.cpp && sym_extract.py a.out
// RUN: clang++ -std=c++11 -shared -O3 test.cpp && sym_extract.py a.out
#define INLINE_VISIBILITY __attribute__((visibility("hidden"), always_inline))

template <class T>
struct Foo {
  void foo();
  void bar();
};

template <class T>
void Foo<T>::foo() {}

template <class T>
inline INLINE_VISIBILITY
void Foo<T>::bar() {}

template struct Foo<int>;
```

This difference creates ABI incompatibilities between Clang and GCC built dylibs. Specifically GCC built dylibs lack definitions for various member functions of `basic_string`, `basic_istream`, `basic_ostream`, `basic_iostream`, and `basic_streambuf` (All of these types are externally instantiated). 

Surprisingly these missing symbols don't cause many problems because the functions are marked `always_inline`  therefore the dylib definition is rarely needed. However when an out-of-line definition is required then GCC built dylibs will fail to link. For example [GCC built dylibs cannot build Clang](http://stackoverflow.com/questions/39454262/clang-build-errors).

This patch works around this issue by adding `_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY` which is used to mark externally instantiated member functions as always inline. When building the library `_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY` sets the symbol's visibility to "default" instead of "hidden", otherwise it acts exactly the same as `_LIBCPP_INLINE_VISIBILITY`.

After applying this patch GCC dylibs now contain:
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE7sungetcEv`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5gbumpEi`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE7sungetcEv`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9sputbackcEc`
  * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getERNS_15basic_streambufIwS2_EE`
  * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRNS_9basic_iosIwS2_EES6_E`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE4setpEPcS4_`
  * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC1EPNS_15basic_streambufIwS2_EE`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6snextcEv`
  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE4swapERS3_`
  * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE4swapERS3_`
  * `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm`
  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRNS_8ios_baseES5_E`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9pubsetbufEPcl`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE10pubseekoffExNS_8ios_base7seekdirEj`
  * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRNS_9basic_iosIwS2_EES6_E`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5pbumpEi`
  * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5seekpENS_4fposI11__mbstate_tEE`
  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE7getlineEPcl`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sgetcEv`
  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getERNS_15basic_streambufIcS2_EE`
  * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRNS_8ios_baseES5_E`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE8in_availEv`
  * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRNS_8ios_baseES5_E`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6sbumpcEv`
  * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRNS_9basic_iosIcS2_EES6_E`
  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getERc`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE6snextcEv`
  * `_ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__initEmw`
  * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE7getlineEPwl`
  * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5tellpEv`
  * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getERw`
  * `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEmc`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE7pubsyncEv`
  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getEPcl`
  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE`
  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRNS_9basic_iosIcS2_EES6_E`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE7pubsyncEv`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sputcEc`
  * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE5seekpExNS_8ios_base7seekdirE`
  * `_ZNKSt3__115basic_streambufIcNS_11char_traitsIcEEE6getlocEv`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5gbumpEi`
  * `_ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEE4swapERS3_`
  * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE5seekpENS_4fposI11__mbstate_tEE`
  * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE5tellpEv`
  * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRS3_S4_E`
  * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getEPwl`
  * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEEC2EPNS_15basic_streambufIwS2_EE`
  * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRS3_S4_E`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE4setgEPcS4_S4_`
  * `_ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__initEPKwmm`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE4setgEPwS4_S4_`
  * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEEC1EPNS_15basic_streambufIwS2_EE`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE8pubimbueERKNS_6localeE`
  * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE4swapERS3_`
  * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC2EPNS_15basic_streambufIwS2_EE`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE10pubseekposENS_4fposI11__mbstate_tEEj`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5pbumpEi`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5sgetcEv`
  * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE4swapERS3_`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE10pubseekposENS_4fposI11__mbstate_tEEj`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sputnEPKcl`
  * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5seekpExNS_8ios_base7seekdirE`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5sgetnEPwl`
  * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRNS_8ios_baseES5_E`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE4setpEPwS4_`
  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sgetnEPcl`
  * `_ZNKSt3__115basic_streambufIwNS_11char_traitsIwEEE6getlocEv`
  * `_ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE8pubimbueERKNS_6localeE`
  * `_ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE8in_availEv`
  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE`
  * `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcmm`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE6sbumpcEv`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE10pubseekoffExNS_8ios_base7seekdirEj`
  * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE`
  * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRS3_S4_E`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE9sputbackcEw`
  * `_ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__initEPKwm`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5sputnEPKwl`
  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E`
  * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE9pubsetbufEPwl`
  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5sputcEw`


This patch has no effect on Clang based builds.



Reviewers: mclow.lists, eugenis, danalbert, jroelofs, EricWF

Subscribers: beanz, cfe-commits, mgorny

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

llvm-svn: 281681
2016-09-16 00:00:48 +00:00
Eric Fiselier 49e2967f27 [libc++] Fix and document visibility attributes for Clang, GCC and Windows.
Summary:
This patch fixes a number of problems with the visibility macros across GCC (on Unix) and Windows (DLL import/export semantics). All of the visibility macros are now documented under `DesignDocs/VisibilityMacros.rst`. Now I'll no longer forget the subtleties of each!

This patch adds two new visibility macros:

* `_LIBCPP_ENUM_VIS` for controlling the typeinfo of enum types. Only Clang supports this.
* `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` for redefining visibility on explicit instantiation declarations. Clang and Windows require this.

After applying this patch GCC only emits one -Wattribute warning opposed to 30+.


Reviewers: mclow.lists, EricWF

Subscribers: beanz, mgorny, cfe-commits

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

llvm-svn: 281673
2016-09-15 22:27:07 +00:00
Shoaib Meenai f6eea04cd1 [libc++] Avoid <memory> include in locale_win32.h
When `_LIBCPP_NO_EXCEPTIONS` is defined, we end up with compile errors
when targeting MSVCRT:

* Code includes `<new>`
* `<new>` includes `<cstdlib>` in order to get `abort`
* `<cstdlib>` includes `<stdlib.h>`, _before_ the `using ::abort`
* `<stdlib.h>` includes `locale_win32.h`
* `locale_win32.h` includes `<memory>`
* `<memory>` includes `<stdexcept>`
* `<stdexcept>` includes `<cstdlib` for `abort`, but that inclusion gets
  (correctly) ignored because of header guards
* `<stdexcept>` references `_VSTD::abort`, which isn't declared

The easiest solution is to make `locale_win32.h` not include `<memory>`,
by removing the use of `unique_ptr` and manually restoring the locale
instead.

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

llvm-svn: 281641
2016-09-15 18:36:13 +00:00
Kuba Brecka 50bc34ca31 [libcxx] Allow sanitizing libcxx with ASan+UBSan simultaneously
Allow building with LLVM_USE_SANITIZER=“Address;Undefined” (and “Undefined;Address”).

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

llvm-svn: 281603
2016-09-15 11:04:53 +00:00
Eric Fiselier a75c1bf9f6 Revert r280944 - Added 'inline' attribute to basic_string's destructor
This patch causes a couple of issues:

1) It triggers http://llvm.org/PR30341. Although the bug is not truly a libc++
bug it breaks the LLVM build using libc++. Reverting this patch is only
a temporary workaround until Clang is fixed.

2) It adds yet another ABI incompatibility when libc++.so is compiled with GCC.
Specifically GCC doesn't ignore the _LIBCPP_INLINE_VISIBILITY on the out-of-line
definition when compiling the dylib. This causes the externally instantiated
~basic_string symbol to have hidden visibility.

This patch should be recommitted after addressing (1) and (2). (2) can be fixed
by adding _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY which is defined as
__attribute__((visibility("default"), always_inline)) as opposed to
_LIBCPP_INLINE_VISIBILITY which makes the symbol hidden.

llvm-svn: 281562
2016-09-14 23:52:01 +00:00
Kuba Brecka f239e6b7a2 [libcxx] Add a TSan regression test for a data race in call_once
Differential Revision: https://reviews.llvm.org/D24297

llvm-svn: 281477
2016-09-14 14:15:42 +00:00
Kuba Brecka eec85de4c0 [libcxx] Fix a typo in test/libcxx/test/target_info.py that prevents running tests on Darwin with sanitizers
Differential Revision: https://reviews.llvm.org/D24297

llvm-svn: 281476
2016-09-14 14:13:50 +00:00
Kuba Brecka d634df526d [libcxx] Enable building and testing of libcxx with ThreadSanitizer on OS X
This patch enables building and testing libcxx under ThreadSanitizer on OS X. CMake builds that have -DLLVM_USE_SANITIZER=Thread will automatically build libcxx with -fsanitize=thread and testing via lit then runs under TSan.

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

llvm-svn: 281475
2016-09-14 14:12:50 +00:00
Asiri Rathnayake d547ac0df9 [libcxx] Fix gcc builds.
Step around a gcc pre-processor defect which causes it to fail to
parse the __has_include macro check.

llvm-svn: 281310
2016-09-13 09:32:32 +00:00
Shoaib Meenai 7afc8fa44c config: Use _LIBCPP_TYPE_VIS_ONLY with enum class
An enum class has associated type info. In the Microsoft ABI, type info
is emitted in the COMDAT section and isn't exported, so clang rightfully
complains about __declspec(dllexport) being unused for an enum class.
On other platforms, we still want to export the type info.

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

llvm-svn: 281264
2016-09-12 21:41:12 +00:00
Shoaib Meenai 4f671370eb config: Fix typo in comment
Testing commit access. NFC.

llvm-svn: 281250
2016-09-12 20:14:44 +00:00
Asiri Rathnayake 8c2bf45da9 [libcxx] Introduce an externally-threaded libc++ variant.
This patch further decouples libc++ from pthread, allowing libc++ to be built
against other threading systems. There are two main use cases:

- Building libc++ against a thread library other than pthreads.

- Building libc++ with an "external" thread API, allowing a separate library to
  provide the implementation of that API.

The two use cases are quite similar, the second one being sligtly more
de-coupled than the first. The cmake option LIBCXX_HAS_EXTERNAL_THREAD_API
enables both kinds of builds. One needs to place an <__external_threading>
header file containing an implementation of the "libc++ thread API" declared
in the <__threading_support> header.

For the second use case, the implementation of the libc++ thread API can
delegate to a custom "external" thread API where the implementation of this
external API is provided in a seperate library. This mechanism allows toolchain
vendors to distribute a build of libc++ with a custom thread-porting-layer API
(which is the "external" API above), platform vendors (recipients of the
toolchain/libc++) are then required to provide their implementation of this API
to be linked with (end-user) C++ programs.

Note that the second use case still requires establishing the basic types that
get passed between the external thread library and the libc++ library
(e.g. __libcpp_mutex_t). These cannot be opaque pointer types (libc++ sources
won't compile otherwise). It should also be noted that the second use case can
have a slight performance penalty; as all the thread constructs need to cross a
library boundary through an additional function call.

When the header <__external_threading> is omitted, libc++ is built with the
"libc++ thread API" (declared in <__threading_support>) as the "external" thread
API (basic types are pthread based). An implementation (pthread based) of this
API is provided in test/support/external_threads.cpp, which is built into a
separate DSO and linked in when running the libc++ test suite. A test run
therefore demonstrates the second use case (less the intermediate custom API).

Differential revision: https://reviews.llvm.org/D21968

Reviewers: bcraig, compnerd, EricWF, mclow.lists
llvm-svn: 281179
2016-09-11 21:46:40 +00:00
Saleem Abdulrasool 0fbd53434d support: clean up MSVC support
Visual Studio 2013 (CRT version 12) added support for many C99 long long and
long double functions. Visual Studio 2015 (CRT version 14) increased C99 and C11
compliance further. Since we don't support Visual Studio versions older than
2013, we can considerably clean up the support header.

Patch by Shoaib Meenai!

llvm-svn: 280988
2016-09-08 20:52:48 +00:00
Aditya Kumar b839888af8 Added 'inline' attribute to basic_string's destructor
Author: laxmansole

Reviewers: howard.hinnant
           mclow.lists
Subscribers: EricWF, flyingforyou, evandro

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

Currently basic_string's destructor is not getting inlined. So adding 'inline' attribute to ~basic_string().
Worked in collaboration with Aditya Kumar.

llvm-svn: 280944
2016-09-08 14:31:44 +00:00
Eric Fiselier 94b812ac77 Avoid compile error by giving the test type a user defined default constructor
llvm-svn: 280780
2016-09-07 03:50:36 +00:00
Marshall Clow a77bb8ef34 Fix PR#30303 - no matching function for call to '__ptr_in_range'
llvm-svn: 280779
2016-09-07 03:32:06 +00:00
Eric Fiselier f8e7a54be8 Improve constexpr tests for std::any
llvm-svn: 280777
2016-09-07 02:38:48 +00:00
Eric Fiselier c1d527d3d8 Fix PR30260 - optional<const T> not working.
This patch fixes PR30260 by using a (void*) cast on the placement argument
to placement new to casts away the const. See also http://llvm.org/PR30260.

As a drive by change this patch also changes the header guard for
<experimental/optional> to _LIBCPP_EXPERIMENTAL_OPTIONAL from _LIBCPP_OPTIONAL.

llvm-svn: 280775
2016-09-07 01:56:07 +00:00
Eric Fiselier 309a50aefb Enable installation of libc++experimental by default.
When libc++experimental was originally created it was empty and therefore there
was no reason to install it. Now that the library contains
<experimental/memory_resource> and <experimental/filesystem> there is a good
reason to install it.

Specifically this patch enables the installation whenever LIBCXX_INSTALL_LIBRARY
is true and LIBCPP_ENABLE_EXPERIMENTAL_LIBRARY is true.

llvm-svn: 280773
2016-09-07 01:15:10 +00:00
Eric Fiselier e9e3377141 Improve CMake output when registering benchmarks
llvm-svn: 280771
2016-09-07 00:57:26 +00:00
Eric Fiselier b683ec20e4 Try 2 - Remove <cstdlib> include from `<exception>`
This patch removes the `<cstdlib>` include from exception where it is no longer
needed. Unlike my previous attempt this patch also adds <cstdlib> where needed
in other headers like <new> and <typeinfo>.

This won't fix the Firefox build issues discussed on IRC but it is more correct
for libc++.

llvm-svn: 280754
2016-09-06 21:25:27 +00:00
Eric Fiselier 350eb52819 Revert r280743 and r280745. Remove <cstdlib> include from `<exception>`
Apparently I missed a number of additional include which need to be added.
Reverting so I can recommit as a single patch with all of the required includes.

llvm-svn: 280752
2016-09-06 21:06:41 +00:00
Eric Fiselier b0b1746962 Add missing <cstdlib> include. Sorry about the bot breakage
llvm-svn: 280745
2016-09-06 20:10:13 +00:00
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