Commit Graph

3928 Commits

Author SHA1 Message Date
Shoaib Meenai bda3c7df78 [libc++] Make _LIBCPP_TYPE_VIS export members
Summary:
Most classes annotated with _LIBCPP_TYPE_VIS need to have at least some
of their members exported, otherwise we have a lot of link errors when
linking against a libc++ built with hidden visibility. This also makes
_LIBCPP_TYPE_VIS be consistent across platforms, since on Windows it
already exports members.

With this change made, any template methods of a class marked
_LIBCPP_TYPE_VIS will also get default visibility when instantiatied,
which is not desirable for clients of libc++ headers who wish to control
their visibility; this is the same issue as PR30642. Annotate all
problematic methods with an explicit visibility specifier to avoid this.

The problematic methods were found by running bad-visibility-finder [1]
against the libc++ headers after making the _LIBCPP_TYPE_VIS change. The
small methods were marked for inlining; the larger ones hidden.

[1] https://github.com/smeenai/bad-visibility-finder

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 296732
2017-03-02 03:22:18 +00:00
Shoaib Meenai bad28c44eb [libc++] Make _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS export members
When building libc++ with hidden visibility, we want explicit template
instantiations to export members. This is consistent with existing
Windows behavior, and is necessary for clients to be able to link
against a hidden visibility built libc++ without running into lots of
missing symbols.

An unfortunate side effect, however, is that any template methods of a
class with an explicit instantiation will get default visibility when
instantiated, unless the methods are explicitly marked inline or hidden
visibility. This is not desirable for clients of libc++ headers who wish
to control their visibility, and led to PR30642.

Annotate all problematic methods with an explicit visibility specifier
to avoid this. The problematic methods were found by running
https://github.com/smeenai/bad-visibility-finder against the libc++
headers after making the _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS change. The
methods were marked with the new _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
macro, which was created for this purpose.

It should be noted that _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS was originally
intended to expand to default visibility, and was changed to expanding
to default type visibility to fix PR30642. The visibility macro
documentation was not updated accordingly, however, so this change makes
the macro consistent with its documentation again, while explicitly
fixing the methods which resulted in that PR.

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

llvm-svn: 296731
2017-03-02 03:02:50 +00:00
Shoaib Meenai a528e74735 [libc++] Mark some std::num_get method templates inline
D29157 will make explicit template instantiations expand to default
visibility, at which point these method templates will need to be
explicitly marked hidden visibility to avoid leaking into other DSOs.
Unfortunately, because of clang PR32114, they must be marked inline (in
conjunction with `-fvisibility-inlines-hidden`) to actually hide them,
since clang doesn't respect the hidden visibility annotation.

Since this involves an ABI change, mark these methods inline in a
separate change, so that the ABI changes can be reviewed separately and
verified to be safe.

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

llvm-svn: 296729
2017-03-02 02:51:27 +00:00
Eric Fiselier e2878b2f97 Remove more usages of REQUIRES-ANY in the test-suite
llvm-svn: 296727
2017-03-02 02:04:49 +00:00
Mehdi Amini 2f75ad4e51 Recommit r296712: "Fix Apple-specific XFAIL directive in libc++ test"
The test is passing with c++11 and c++14 but not c++1z on this
particular version of the compiler. Try to use lit boolean condition
to satisfy this constaint.

llvm-svn: 296725
2017-03-02 02:01:11 +00:00
Mehdi Amini cd0b56c5cf Revert "Fix Apple-specific XFAIL directive in libc++ test"
This reverts commit r296712. It broke our bot.

It turns out that the test is passing with c++11 and c++14 but
not c++1z on this particular version of the compiler. Since one
job is defaulting to c++1z and the other is testing all config I'm
not sure how to fix this...

llvm-svn: 296724
2017-03-02 01:57:40 +00:00
Eric Fiselier 803a491a64 Fix python 3 syntax error in sym_diff
llvm-svn: 296716
2017-03-02 00:03:01 +00:00
Mehdi Amini 48c4a82105 Fix Apple-specific XFAIL directive in libc++ test
This tests is failing in XCode 7.0. But Xcode 7.3 that shipped
an updated clang has this test passing. This is fixing green dragon
which runs this configuration.

llvm-svn: 296712
2017-03-01 23:45:03 +00:00
Mehdi Amini dc5474f800 Fix Apple-specific XFAIL directive in libc++ test
These tests are failing in XCode 8.0, 8.1, and 8.2, but not in Xcode
8.3. Annoyingly the version numbering for clang does not follow Xcode
and is bumped to 8.1 only in Xcode 8.3. So Xfailing apple-clang-8.0
should catch all cases here.

llvm-svn: 296704
2017-03-01 23:14:34 +00:00
Eric Fiselier d94189dc50 Generate the test configuration even when LIBCXX_INCLUDE_TESTS=OFF.
This patch changes the CMake configuration so that it always
generates the test/lit.site.cfg file, even when testing is disabled.

This allows users to test libc++ without requiring them to have
a full LLVM checkout on their machine.

llvm-svn: 296685
2017-03-01 21:53:30 +00:00
Petr Hosek 11d1770e14 [libcxx] Support threads on Fuchsia
Differential Revision: https://reviews.llvm.org/D30278

llvm-svn: 296573
2017-03-01 03:09:18 +00:00
Eric Fiselier f4bf2438c0 Mark test as unsupported in C++11
llvm-svn: 296571
2017-03-01 02:52:04 +00:00
Eric Fiselier 81529ba9ab Fix test failures due to bad test hasher
llvm-svn: 296568
2017-03-01 02:34:27 +00:00
Eric Fiselier acb21581d7 Improve diagnostics when an invalid hash is used in an unordered container.
This patch adds a static assertion that the specified hash meets
the requirements of an enabled hash, and it ensures that the static
assertion is evaluated before __compressed_pair is instantiated.
That way the static assertion diagnostic is emitted first.

llvm-svn: 296565
2017-03-01 02:02:28 +00:00
Eric Fiselier 1ad881c3e4 Fix PR32097 - is_abstract doesn't work on class templates.
This patch fixes llvm.org/PR32097 by using the __is_abstract
builtin type-trait instead of the previous library-only implementation.

All supported compilers provide this trait. I've tested as far
back as Clang 3.2, GCC 4.6 and MSVC trunk.

llvm-svn: 296561
2017-03-01 01:27:14 +00:00
Michael Park 466f0653a3 Updated the XFAIL comment in variant tests.
Summary:
`ConstexprTestTypes::NoCtors` is an aggregate type (and consequently a literal type) in C++17,
but not in C++14 since it has a base class. This patch updates the comment to accurately describe the reason for the XFAIL.

Reviewers: EricWF

Reviewed By: EricWF

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

llvm-svn: 296558
2017-03-01 01:07:56 +00:00
Steven Wu 1f27eaf5aa Remove XFAIL in implicit_deduction_guides tests
The clang assertion causing these tests failing with sanitizer is fixed
in r295794. All the bots running libcxx tests should be upgraded and
running the compiler with the fix.

llvm-svn: 296385
2017-02-27 21:10:41 +00:00
Asiri Rathnayake 68050fd694 Fix LIBCXX_HAS_EXTERNAL_THREAD_API builds. NFC.
Add the missing check in the __config header.

llvm-svn: 296351
2017-02-27 16:10:57 +00:00
Asiri Rathnayake 01eb47800b Fix typo in error message. NFC.
llvm-svn: 296346
2017-02-27 15:49:51 +00:00
Asiri Rathnayake 749c557d81 Fix cmake dependency for the external-thread-library variant. NFC.
llvm-svn: 296338
2017-02-27 13:19:25 +00:00
Saleem Abdulrasool b455a8331c Revert "threading_support: make __thread_sleep_for be alertable"
This reverts SVN r295329.  Although `__libcpp_thread_sleep_for` should
be alertable, the implementation causes a large regression in the test
suite.  Add a FIXME item there for now to get the test suite in a better
state before attempting to fix that behaviour.

llvm-svn: 295561
2017-02-18 19:28:43 +00:00
Saleem Abdulrasool c409aa8a9e test: silence warnings on clang under clang-cl
When running under clang-cl mode, we do not define `__GNUC__`, resulting
in the test failing.

llvm-svn: 295560
2017-02-18 19:28:41 +00:00
Saleem Abdulrasool af14a631d0 math: add type promoting template definition on MSVCRT
When building with MSVCRT, we need to manually provide the type
promoting overloads to allow the correct type deduced invocation for
signbit(Int) and fpclassify(int).

llvm-svn: 295559
2017-02-18 19:28:38 +00:00
Saleem Abdulrasool 632438f6a0 test: explicitly size enumeration
On certain targets, enumerations may be smaller than an `unsigned long`.
Use an explicitly sized enumeration.

llvm-svn: 295558
2017-02-18 19:28:36 +00:00
Saleem Abdulrasool aa62a752ee test: prevent incorrect quoting of paths
The path would previously get an extra leading space as the arguments
would be parsed when generating the final command to run.  Pretokenise
the arguments to permit proper quoting of the paths.  This avoids a
number of ignoring non-existent path warnings from clang.

llvm-svn: 295511
2017-02-17 23:08:46 +00:00
Saleem Abdulrasool 2d014f8106 math: fix typo in macro
MAJOR was misspelt as NAJOR.  Fix the spelling.

llvm-svn: 295510
2017-02-17 23:08:44 +00:00
Saleem Abdulrasool f45638beba cmath: Use c99 math on a new enough msvcrt
MSVCRT 14+ supports the C99 math routines that we need.  Use them
accordingly.

llvm-svn: 295509
2017-02-17 23:08:42 +00:00
Eric Fiselier 3c35491f02 Update all bug URL's to point to https://bugs.llvm.org/...
llvm-svn: 295434
2017-02-17 08:37:03 +00:00
Eric Fiselier 7f1604aae6 Use inline namespaces with GCC instead of __attribute__((__strong__)).
GCC 7.0.1 started warning that __attribute__((__strong__)) is depricated.
This patch switches to using inline namespace with GCC instead. I believe
this wasn't done originally in order to support older GCC versions w/o
support for inline namespaces, or because earlier versions of GCC warned
users that the STL was using an inline namespace (even though it shouldn't affect users).

However I believe all of the above problems are gone for GCC 4.9 and greater.
Therefore switching to using inline namespaces instead of using __strong__
is the most correct behavior.

llvm-svn: 295428
2017-02-17 07:31:38 +00:00
Eric Fiselier c9d5da137d Remove dead code in test
llvm-svn: 295423
2017-02-17 07:00:04 +00:00
Eric Fiselier b6741d9695 add implicit deduction guide tests for string_view
llvm-svn: 295422
2017-02-17 06:59:11 +00:00
Eric Fiselier e427e4b81b Work around Clang assertion when testing C++17 deduction guides with '-g'.
llvm-svn: 295417
2017-02-17 05:04:09 +00:00
Eric Fiselier 07e93d3b00 Add doc for _LIBCPP_ENABLE_CXX17_DISABLED_AUTO_PTR and make it work under _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
llvm-svn: 295407
2017-02-17 03:30:25 +00:00
Eric Fiselier 2a1bfa98d1 [libcxx] Remove unexpected handlers in C++17
Summary:
This patch implements [P0003R5](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0003r5.html) which removes exception specifications from C++17.

The only changes to the library are removing `set_unexpected`, `get_unexpected`, `unexpected`, and `unexpected_handler`. These functions can be re-enabled in C++17 using `_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS`.

@mclow.lists what do you think about removing stuff is this way?

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: mclow.lists, cfe-commits

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

llvm-svn: 295406
2017-02-17 03:25:08 +00:00
Eric Fiselier 63895ca6e7 Mark a couple for basic_string member templates as inline. no ABI change this time.
llvm-svn: 295403
2017-02-17 02:31:56 +00:00
Eric Fiselier e13037046a update revision in CHANGELOG.TXT and fix python error
llvm-svn: 295399
2017-02-17 01:56:57 +00:00
Eric Fiselier de547c6a23 Remove more basic_string member function templates from the dylib exports
llvm-svn: 295398
2017-02-17 01:53:16 +00:00
Eric Fiselier dd3ba794ef [libc++] Fix PR 31938 - std::basic_string constructors use non-deductible parameter types.
Summary:
This patch fixes http://llvm.org/PR31938. The description below is copy/pasted from the bug:

The standard says:

template<class charT, class traits = char_traits<charT>,
         class Allocator = allocator<charT>>
class basic_string {
  using value_type = typename traits::char_type;
  // ...
  basic_string(const charT* s, const Allocator& a = Allocator());
};

libc++ actually chooses to declare the constructor as

  basic_string(const value_type* s, const Allocator& a = Allocator());

The implicit deduction guides from class template argument deduction make what was previously an implementation detail visible:

std::basic_string s = "foo"; // error, can't deduce charT.

The constructor in question is in the libc++ DSO, but fortunately it looks like fixing this will not result in an ABI break.


@rsmith How does this look? I did more than just the constructors mentioned in the PR, but IDK how far to take it.


Reviewers: mclow.lists, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, rsmith

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

llvm-svn: 295393
2017-02-17 01:17:10 +00:00
Eric Fiselier 57b93eb78f add tests for ENAMETOOLONG
llvm-svn: 295390
2017-02-17 01:00:37 +00:00
Marshall Clow 077081d4d5 Update a couple of issue statuses
llvm-svn: 295355
2017-02-16 18:50:30 +00:00
Saleem Abdulrasool 3d99648f00 math: correct the MSVCRT condition
Fixes a number of tests in the testsuite on Windows.

llvm-svn: 295330
2017-02-16 15:47:50 +00:00
Saleem Abdulrasool 305b4f2ba9 threading_support: make __thread_sleep_for be alertable
On Windows, we were using `Sleep` which is not alertable.  This means
that if the thread was used for a user APC or WinProc handling and
thread::sleep was used, we could potentially dead lock.  Use `SleepEx`
with an alertable sleep, resuming until the time has expired if we are
awoken early.

llvm-svn: 295329
2017-02-16 15:47:45 +00:00
Eric Fiselier d5abcd1b2e Add tests for noexcept functions
llvm-svn: 294995
2017-02-13 22:44:39 +00:00
Saleem Abdulrasool 3444e9fa15 config: disable thread safety analysis on COFF
clang cannot properly handle __declspec and __attribute__ on classes
right now.  This prevents the shared_mutex tests from working.  Disable
the use of the annotation on COFF targets.

llvm-svn: 294958
2017-02-13 15:26:51 +00:00
Saleem Abdulrasool 8a5789ebd1 math: actually pull the declarations/overloads into std
The previous changes missed the change to include/cmath.  These changes
allow some of the rand.distribution tests to pass on Windows.

llvm-svn: 294957
2017-02-13 15:26:50 +00:00
Saleem Abdulrasool 4715d12345 test: mark another test as requiring pthreads
This is checking pthread specific behaviour.  Add a requirement on
pthreads.

llvm-svn: 294956
2017-02-13 15:26:47 +00:00
Saleem Abdulrasool ce5ce02604 math: follow up to SVN r294902
Pull in the math functions from ucrt 14+ after auditing the library.  It
seems that they are now complete for C99 math.  Fixes more windows
tests!

llvm-svn: 294918
2017-02-12 21:42:37 +00:00
Saleem Abdulrasool b2684a52c6 test: use char32_t rather than wchar_t
wchar_t is not as portable as char32_t.  On Windows, wchar_t is
16-bytes and on Linux 32-bits.  The conversion to utf8 causes the
characters to exceed the limits on char16_t, resulting in tautological
comparisons.

llvm-svn: 294917
2017-02-12 21:42:35 +00:00
Saleem Abdulrasool 633c3b0756 test: mark requirement for pthread test
This test explicitly is checking the behaviour of std::thread and
pthread interactions.  This requires pthreads.  Add an appropriate
requirement.

llvm-svn: 294903
2017-02-12 17:37:48 +00:00
Saleem Abdulrasool 2fe5658d9a math: pull more C functions from std
The newer ucrt version provides the gamma meth routines.  Includede them
when building the library.

llvm-svn: 294902
2017-02-12 17:37:45 +00:00
Saleem Abdulrasool 0d467ff53f test: squelch -Wreturn-type error
Add an unreachable marker to avoid a -Wreturn-type error when building
on Windows.

llvm-svn: 294901
2017-02-12 17:37:44 +00:00
Saleem Abdulrasool a24d7dff09 cmath: adjust math forwards for Windows
The newer versions of ucrt have the math routines.  Use the CRT version
to determine if we should include the math routines.  Fixes two tests
for Windows.

llvm-svn: 294899
2017-02-12 16:44:17 +00:00
Ed Schouten 252da3b3b4 Remove a now unneeded __CloudABI__ check.
CloudABI has gained the setlocale() function in the meantime, meaning
there is no longer a need to conditionalize this.

llvm-svn: 294833
2017-02-11 08:33:16 +00:00
Ed Schouten de5669e46c Fix the build of thread.cpp on CloudABI.
CloudABI does provide unistd.h, but doesn't define __unix__. We need to
include this header file to make hardware_concurrency work.

llvm-svn: 294832
2017-02-11 08:30:18 +00:00
Marshall Clow 3bc2e08429 Fix a bug I introduced in the tests for experimental::lcm and experimental::gcd.
llvm-svn: 294798
2017-02-10 22:44:14 +00:00
Marshall Clow 58fc1b50d8 Make lcm/gcd work better in edge cases. Fixes a UBSAN failure.
llvm-svn: 294779
2017-02-10 20:49:08 +00:00
Eric Fiselier 2279ee3144 Fix yet another Apple buildit bug
llvm-svn: 294732
2017-02-10 09:25:15 +00:00
Eric Fiselier 637160c55a Attempt to fix Apple buildit bots
llvm-svn: 294731
2017-02-10 09:16:29 +00:00
Eric Fiselier d22c9dc422 Recommit "Split exception.cpp and new.cpp implementation into different files for different runtimes."
This recommits r294707 with additional fixes. The main difference is
libc++ now correctly builds without any ABI library.

exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
each different ABI library we support, and it's getting unmaintainable.

This patch breaks down exception.cpp into multiple different header files,
roughly one per implementation. Additionally it moves the definitions of
exceptions in new.cpp into the correct implementation header.

This patch also removes an unmaintained libc++abi configuration.
This configuration may still be used by Apple internally but there
are no other possible users. If it turns out that Apple still uses
this configuration internally I will re-add it in a later commit.
See http://llvm.org/PR31904.

llvm-svn: 294730
2017-02-10 08:57:35 +00:00
Eric Fiselier 8dcdeaeb35 Revert "Split exception.cpp and new.cpp implementation into different files for different runtimes."
The compiler-rt CMake configuration needs some tweaking before this can land.

llvm-svn: 294727
2017-02-10 07:43:08 +00:00
Eric Fiselier 328bcc5e2b Properly escape ShellTest subsitutions on Windows. Try 2
llvm-svn: 294721
2017-02-10 06:59:07 +00:00
Saleem Abdulrasool 738a3f97a6 test: XFAIL windows for non-portable test
This test validates that the lock_guard is declared variadically across
C++03 and C++11.  Given the lack of stable ABI on Windows and the fact
that the RTTI encoding on Windows is different, XFAIL it on that target.

llvm-svn: 294720
2017-02-10 06:51:21 +00:00
Saleem Abdulrasool a7c72894f8 test: fix test under Windows
When running the test under clang-cl, we do not report `__GNUC__`, which
is needed to supress the warnings which are being treated as errors.

llvm-svn: 294719
2017-02-10 06:51:19 +00:00
Eric Fiselier 7b9da0c480 properly escape compiler path in .sh.cpp tests
llvm-svn: 294718
2017-02-10 06:38:02 +00:00
Saleem Abdulrasool d7bd094716 test: allow -target usage on Windows
When running the tests on Windows with a debug build, _DEBUG must be
added to the flags prior to the -target as the forced inclusion of a
header will prevent the compile test for the flag to fail.

llvm-svn: 294716
2017-02-10 06:24:34 +00:00
Eric Fiselier 7f15e08ca1 Correctly default to using the system libc++abi on Apple.
This patch fixes a regression where libc++ didn't correctly
select the system libc++abi when no in-tree version was found.

llvm-svn: 294712
2017-02-10 05:07:03 +00:00
Eric Fiselier def60acdf5 Split exception.cpp and new.cpp implementation into different files for different runtimes.
exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
each different ABI library we support, and it's getting unmaintainable.

This patch breaks down exception.cpp into multiple different header files,
roughly one per implementation. Additionally it moves the definitions of
exceptions in new.cpp into the correct implementation header.

This patch also removes an unmaintained libc++abi configuration.
This configuration may still be used by Apple internally but there
are no other possible users. If it turns out that Apple still uses
this configuration internally I will re-add it in a later commit.
See http://llvm.org/PR31904.

llvm-svn: 294707
2017-02-10 04:25:33 +00:00
Saleem Abdulrasool fb9ae0e3fe docs: add some documentation for building on Windows
This covers how to build libc++ for Windows.  This allows others to
replicate the MS ABI style build for libc++.  It only depends on msvcrt
as it uses the Windows threading model and the Windows ABI and can serve
as an ABI compatible replacement for msvcprt.

llvm-svn: 294705
2017-02-10 03:58:20 +00:00
Eric Fiselier 5955cbd5dd Attempt to fix finding clang++ on Windows
llvm-svn: 294699
2017-02-10 03:20:02 +00:00
Saleem Abdulrasool 9e08f9a9ad __threading_support: fix windows build
The build was broken as there was no overload for long and
std::chrono::nanoseconds.  Add an explicit conversion to use the
operator+.

llvm-svn: 294698
2017-02-10 02:49:52 +00:00
Mehdi Amini 48b4b04700 Fully qualify (preprend ::) calls to math functions from libc
Summary:
This can cause a compile failure in cases like:

double log(double);
namespace foo {
  namespace log {}
}
using namespace foo;
void bar(int i) {
  log((double)i);
}

Reviewers: EricWF, mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 294696
2017-02-10 02:44:23 +00:00
David L. Jones 4b22736222 Check for musl-libc's max_align_t in addition to other variants.
Summary:
Libcxx will define its own max_align_t when it is not available. However, the
availability checks today only check for Clang's definition and GCC's
definition. In particular, it does not check for musl's definition, which is the
same as GCC's but guarded with a different macro.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: chandlerc, cfe-commits

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

llvm-svn: 294683
2017-02-10 01:27:42 +00:00
Eric Fiselier 8882eeece9 Add missing libc++ import
llvm-svn: 294673
2017-02-10 00:01:01 +00:00
Eric Fiselier d57282791d add missing python import
llvm-svn: 294660
2017-02-09 23:29:08 +00:00
Eric Fiselier 4f258efad7 Move libcxx/test/libcxx python package into libcxx/utils/libcxx.
This patch merges the test python package with the newly
created package in utils.

llvm-svn: 294651
2017-02-09 23:18:11 +00:00
Eric Fiselier 0b37f209bf Start libc++ python cleanup and consolidation.
Libc++ frequently creates and uses utilities written in python.
Currently there are python modules under both libcxx/test and
libcxx/util. My goal with these changes is to consolidate them
into a single package under libcxx/utils/libcxx.

llvm-svn: 294644
2017-02-09 22:53:14 +00:00
Eric Fiselier a18ef6f1f9 Fix PR31916 - std::visit rejects visitors accepting lvalue arguments
A static assertion was misfiring since it checked
is_callable<Visitor, decltype(__variant_alt<T>.value)>. However
the decltype expression doesn't capture the value category as
required. This patch applies extra braces to decltype to fix
that.

llvm-svn: 294612
2017-02-09 19:01:22 +00:00
Joerg Sonnenberger 9e8a082db4 Use protected name for the prototype arguments.
llvm-svn: 294585
2017-02-09 14:12:29 +00:00
Asiri Rathnayake 54a987e1f1 Threading support: externalize sleep_for() function.
Different platforms implement the wait/sleep functions in difrerent ways.
It makes sense to externalize this into the threading API.

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

Reviewers: EricWF, joerg
llvm-svn: 294573
2017-02-09 09:31:41 +00:00
Petr Hosek b494288b9e [libcxx][CMake] Support in-tree libunwind when building as part of runtimes
When building as part of runtimes, there is no predefined order in
which the runtimes are loaded, so the targets from other projects
might not be available. We need to rely on HAVE_<name> variables
instead in that case.

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

llvm-svn: 294553
2017-02-09 02:19:43 +00:00
Eric Fiselier 4ae0369b8e Update info for LWG 2665 in upcoming_meeting.html
llvm-svn: 294501
2017-02-08 19:04:18 +00:00
Michal Gorny f7132c83f1 [test] Fix hard_link_count test to account for fs with dir nlink==1
Filesystems are not required to maintain a hard link count consistent
with number of subdirectories. For example, on btrfs all directories
have nlink==1. Account for that in the test.

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

llvm-svn: 294431
2017-02-08 09:57:32 +00:00
Marshall Clow a2e54b632e Temporarily disable the LCM/GCD tests under UBSAN.
llvm-svn: 294417
2017-02-08 07:40:59 +00:00
Eric Fiselier d35528b3e7 Add missing include in <numeric>
llvm-svn: 294393
2017-02-08 00:14:13 +00:00
Eric Fiselier 4cdd915fda Prevent UBSAN from generating unsigned overflow diagnostics in the hashing internals
llvm-svn: 294391
2017-02-08 00:10:10 +00:00
Eric Fiselier c0d5590a3b Fix bugs in filesystem detected by _LIBCPP_ASSERT.
Recently I turned on libc++'s debug mode assertions when
CMake is configured with -DLIBCXX_ENABLE_ASSERTIONS=ON. This
change exposed assertion failures caused by bugs in filesystem.
This patch fixes those failures.

The first bug was that `PathParser` was using front()/back()
on empty string views in order to get the address of the character.
However this is UB on empty strings. Those operations now use data()
to obtain the pointer.

The second bug was that directory_iterator attempted to capture errno when it
was unset and there was an assertion to detect this.

llvm-svn: 294360
2017-02-07 21:51:58 +00:00
Eric Fiselier 357120e8a2 fix python3 syntax error
llvm-svn: 294355
2017-02-07 21:21:17 +00:00
Eric Fiselier d8f7f31121 Fix test failures when using modules.
llvm-svn: 294353
2017-02-07 21:20:31 +00:00
Dan Albert 71478363d5 Use copy.deepcopy instead of doing it manually.
Reviewers: EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 294350
2017-02-07 21:04:19 +00:00
Marshall Clow 4513057d66 Stop using random_shuffle in the libc++ test suite. It's going to be removed in c++17. Use shuffle() instead. No change to libc++, just the tests.
llvm-svn: 294328
2017-02-07 18:41:25 +00:00
Marshall Clow 891239e64f Mark LWG2784 as ready
llvm-svn: 294311
2017-02-07 15:34:20 +00:00
Saleem Abdulrasool 833cf8bdb6 filesystem: return the constructed object
This really should get identified properly by the compiler to convert to
a NVRO, but compress the code anyways.  This makes the implementation
identical to directory_iterator.cpp

llvm-svn: 294270
2017-02-07 02:46:59 +00:00
Marshall Clow 7a1c0efff4 Add some tests to verify that we implement LWG#2837 correctly. No functional change.
llvm-svn: 294194
2017-02-06 16:03:23 +00:00
Marshall Clow 01595ef77d Fix a typo - extra '>'
llvm-svn: 294190
2017-02-06 15:29:03 +00:00
Marshall Clow 62ab88143e Set up 'upcoming meeting' bug list
llvm-svn: 294189
2017-02-06 15:17:22 +00:00
Saleem Abdulrasool bcc85cbcde Refer to _LIBCPP_MSVC macro where applicable
Replace preprocess conditions of defined(_MSC_VER) &&
!defined(__clang__) with defined(_LIBCPP_MSVC).  NFC.

Patch by Dave Lee!

llvm-svn: 294171
2017-02-06 05:26:49 +00:00
Eric Fiselier 25e9c7aa55 Mark LWG 2765 as complete. No changes needed
llvm-svn: 294167
2017-02-06 02:41:49 +00:00
Eric Fiselier 9af60c4a8b Implement LWG 2773 - std::ignore should be constexpr.
In addition to the PR for LWG 2773 this patch also ensures
that each of std::ignores constructors or assignment operators
are constexpr.

llvm-svn: 294165
2017-02-06 01:25:31 +00:00
Stephan T. Lavavej 134ed9986a [libcxx] [test] Strip trailing whitespace.
No functional change, no code review.

llvm-svn: 294161
2017-02-05 22:48:27 +00:00
Stephan T. Lavavej 881d861346 [libcxx] [test] Fix comment typos.
No functional change, no code review.

llvm-svn: 294160
2017-02-05 22:48:20 +00:00
Stephan T. Lavavej ae2798fc53 [libcxx] [test] Avoid MSVC's non-Standard ABI in underlying_type.pass.cpp.
When compiled with Clang for Windows, this was emitting "enumerator value
evaluates to 4294967295, which cannot be narrowed to type 'int' [-Wc++11-narrowing]".

The test should more strenuously avoid poking this ABI deficiency (and it
already has coverage for explicitly specified underlying types).

Fixes D29140.

llvm-svn: 294159
2017-02-05 22:48:13 +00:00
Stephan T. Lavavej 0d6482f3bb [libcxx] [test] Fix Clang -Wpessimizing-move "moving a temporary object prevents copy elision".
N4618 30.6.6 [futures.unique_future]/12 declares "shared_future<R> share() noexcept;".

Fixes D29139.

llvm-svn: 294158
2017-02-05 22:48:07 +00:00
Stephan T. Lavavej 3c56112e3f [libcxx] [test] Fix Clang -Wdeprecated-declarations with MSVC's CRT.
libcxx's tests use various C Standard Library functions that have been
marked by MSVC's CRT as deprecated by Microsoft (not by ISO).

libcxx's usage is cromulent (just checking with decltype to see if the functions
are being dragged in by various headers as required by the Standard), so
defining _CRT_SECURE_NO_WARNINGS will silence the warnings in a targeted manner.
This needs to be defined before including any CRT headers.

Also, make this file prettier.

Fixes D29138.

llvm-svn: 294157
2017-02-05 22:48:02 +00:00
Stephan T. Lavavej 8bb0ffb072 [libcxx] [test] Fix Clang -Wunused-local-typedef, part 3/3.
test/std/strings/string.classes/typedefs.pass.cpp
Actually test what basic_string's typedefs stand for.

test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
NotDerived and ND were completely unused.

test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
P2 was mistakenly not being used. Yes, that's
right: -Wunused-local-typedef CAUGHT A MISTAKE! AMAZING!

Fixes D29137.

llvm-svn: 294156
2017-02-05 22:47:54 +00:00
Stephan T. Lavavej 50bd9576f0 [libcxx] [test] Fix Clang -Wunused-local-typedef, part 2/3.
These typedefs were completely unused.

Fixes D29136.

llvm-svn: 294155
2017-02-05 22:47:41 +00:00
Stephan T. Lavavej 03fe6e2da2 [libcxx] [test] Fix Clang -Wunused-local-typedef, part 1/3.
Guard typedefs and static_asserts with _LIBCPP_VERSION.

test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
Additionally deal with conditional compilation.

test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
Additionally deal with typedefs used by other typedefs.

Fixes D29135.

llvm-svn: 294154
2017-02-05 22:47:09 +00:00
Marshall Clow 6a1d078560 Restore the _NOEXCEPT on the dtor of bad_optional_access. Destructors are noexcept by default, so it's not really needed, but the other exception classes have the _NOEXCEPT, and gcc complains if these are missing. I think we should remove them all - but not today.
llvm-svn: 294142
2017-02-05 20:52:32 +00:00
Eric Fiselier 46663d5567 Fix variant build errors with GCC 7
llvm-svn: 294141
2017-02-05 20:36:07 +00:00
Eric Fiselier 623fee72c6 Adjust Apple ABI list after r294133
llvm-svn: 294139
2017-02-05 20:17:41 +00:00
Eric Fiselier abf80c6949 Adjust Linux ABI list after r294133
llvm-svn: 294138
2017-02-05 20:14:18 +00:00
Marshall Clow e29b1ed50b Change the base class of std::bad_optional_access. This is a (subtle) ABI change, and is in response to http://http://wg21.link/LWG2806, which I *expect* to be adopted in Kona. I am making this change now in anticipation, and will get it into 4.0, because (a) 4.0 is the first release with std::optional, and (b) I don't want to make an ABI-change later, when the user base should be significantly larger. Note that I didn't change std::experimental::bad_optional_access, because that's still specified to derive from std::logic_error.
llvm-svn: 294133
2017-02-05 20:06:38 +00:00
Saleem Abdulrasool 2f7ceb120e filesystem: fix n4100 conformance for `temp_directory_path`
N4100 states that an error shall be reported if
`!exists(p) || !is_directory(p)`.  We were missing the first half of the
conditional.  Invert the error and normal code paths to make the code
easier to follow.

llvm-svn: 294127
2017-02-05 17:21:52 +00:00
Eric Fiselier f1fe87e605 Remove CMake hack
llvm-svn: 294116
2017-02-05 01:19:02 +00:00
Eric Fiselier cd1703b241 Fix typo in docs
llvm-svn: 294115
2017-02-05 01:16:25 +00:00
Eric Fiselier e49cdfbeea Recommit [libcxx] Never use <cassert> within libc++
It is my opinion that libc++ should never use `<cassert>`, including in the `dylib`.
This patch remove all uses of `assert` from within libc++ and replaces most of them with `_LIBCPP_ASSERT` instead.

Additionally this patch turn `LIBCXX_ENABLE_ASSERTIONS`  off by default,
because the standard library should not be aborting user programs unless explicitly asked to.

llvm-svn: 294107
2017-02-04 23:22:28 +00:00
Eric Fiselier 5ddaeb888d Fix inconsistency in tuple's SFINAE. Patch from Andrey Khalyavin"
llvm-svn: 294106
2017-02-04 22:57:01 +00:00
Eric Fiselier dfc9947636 Mark basic_string::assign templates as inline to improve ABI stability.
Visible definitions for basic_string::assign are sometimes emitted in
the dylib depending on the version of LLVM used to compile libc++.
This can cause the check-cxx-abilist target to fail.

This patch attempts marks the basic_string::assign templates as inline
to prevent this. That way the export list is consistent across LLVM
versions.

llvm-svn: 294100
2017-02-04 20:38:35 +00:00
Eric Fiselier fb5c750222 Undefine min/max in __tree
llvm-svn: 294099
2017-02-04 20:27:46 +00:00
Dan Albert f9dc6670bc Avoid implementation defined behavior in a test.
Summary:
num_put::put uses %p for pointer types, but the exact format of %p is
implementation defined behavior for the C library. Compare output to
snprintf for portability.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 293926
2017-02-02 19:44:11 +00:00
Asiri Rathnayake e396d8e260 Extend XFAIL to c++98.
NFC.

llvm-svn: 293881
2017-02-02 11:56:26 +00:00
Marshall Clow 6f033f0c30 Fix up some no-exception compile failures
llvm-svn: 293623
2017-01-31 13:12:32 +00:00
Alex Lorenz 143b58577d Workaround new -Wshadow warning introduced by r293599
llvm-svn: 293619
2017-01-31 12:37:48 +00:00
Marshall Clow d107be846f Fix PR#31779: basic_string::operator= isn't exception safe.
llvm-svn: 293599
2017-01-31 03:40:52 +00:00
Justin Bogner 8335dd314f Revert "Adorn __call_once_proxy with `inline` and `_LIBCPP_INLINE_VISIBILITY`"
While this change didn't really hurt, it does lead to spurious
warnings about not being able to override weak symbols if you end up
linking objects built with this change to ones built without it.
Furthermore, since __call_once_proxy is called indirectly anyway it
doesn't actually inline ever.

Longer term, it would probably make sense to give this symbol internal
visibility instead.

This reverts r291497

llvm-svn: 293581
2017-01-31 01:26:09 +00:00
Saleem Abdulrasool cd79d0f5f3 experimental: avoid using raw _WIN32 in filesystem
Use the _LIBCPP_WIN32API macro instead of _WIN32 checks.  Fix a missed
renaming for style conformance.

llvm-svn: 293543
2017-01-30 19:57:27 +00:00
Saleem Abdulrasool 714058d29a experimental: port directory_iterator to Windows
This adds a basic first cut implementation for directory_iterator on
Windows.  It uses the FindFirstFile/FindNextFile which has the same
restrictions as opendir/readdir where there exists a TOCTOU race
condition.

llvm-svn: 293531
2017-01-30 18:50:34 +00:00
Saleem Abdulrasool cb04468c6a experimental: add missing file header
The directory_iterator implementation file was missing the file header.
Add one.  NFC.

llvm-svn: 293530
2017-01-30 18:50:32 +00:00
Saleem Abdulrasool e4ddaa4427 experimental: remove some extraneous _LIBCPP_FUNC_VIS
These member functions were decorated with `_LIBCPP_FUNC_VIS` when the
class is also decorated with external visibility.  This breaks down when
building for PE/COFF, where the member function cannot be decorated if
it is within a decorated class.  The class attribute will propagate to
the member.  Remove the extraneous decoration.

llvm-svn: 293454
2017-01-30 03:58:26 +00:00
Saleem Abdulrasool 14a05e62fa experimental: inline single use of a typedef
The typedef is not particularly long, and used in exactly one location.
Just spell it out at the site.  NFC.

llvm-svn: 293450
2017-01-30 00:15:50 +00:00
Saleem Abdulrasool a902e7aa94 experimental: tolerate the existence of a `__deref` macro
Microsoft's SAL has a `__deref` macro which results in a compilation
failure when building the filesystem module on Windows.  Rename the
member function internally to avoid the conflict.

llvm-svn: 293449
2017-01-30 00:15:47 +00:00
Saleem Abdulrasool 603b38dca1 experimental: remove dead function
This template was defined inline, within the TU only and had no uses
across the entire repository.  Remove the dead code.  NFC.

llvm-svn: 293445
2017-01-29 22:31:28 +00:00
Saleem Abdulrasool 87996f906a config: prevent the re-definition of a macro
This causes unnecessary warnings when building with `cl`.  Newer
versions of the C standard permit the redefinition of the macro to the
same value (which is the case here), unfortunately, `cl` does not yet
implement this.  Add a check to prevent the redefinition.

llvm-svn: 293439
2017-01-29 18:16:33 +00:00
Dimitry Andric 83dca5c3d1 Disable thread safety analysis for some functions in __thread_support
Many thread-related libc++ test cases fail on FreeBSD, due to the
following -Werror warnings:

    In file included from test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp:17:
    In file included from include/thread:97:
    In file included from include/__mutex_base:17:
    include/__threading_support:222:1: error: mutex '__m' is still held at the end of function [-Werror,-Wthread-safety-analysis]
    }
    ^
    include/__threading_support:221:10: note: mutex acquired here
      return pthread_mutex_lock(__m);
             ^
    include/__threading_support:231:10: error: releasing mutex '__m' that was not held [-Werror,-Wthread-safety-analysis]
      return pthread_mutex_unlock(__m);
             ^
    include/__threading_support:242:1: error: mutex '__m' is still held at the end of function [-Werror,-Wthread-safety-analysis]
    }
    ^
    include/__threading_support:241:10: note: mutex acquired here
      return pthread_mutex_lock(__m);
             ^
    include/__threading_support:251:10: error: releasing mutex '__m' that was not held [-Werror,-Wthread-safety-analysis]
      return pthread_mutex_unlock(__m);
             ^
    include/__threading_support:272:10: error: calling function 'pthread_cond_wait' requires holding mutex '__m' exclusively [-Werror,-Wthread-safety-analysis]
      return pthread_cond_wait(__cv, __m);
             ^
    include/__threading_support:278:10: error: calling function 'pthread_cond_timedwait' requires holding mutex '__m' exclusively [-Werror,-Wthread-safety-analysis]
      return pthread_cond_timedwait(__cv, __m, __ts);
             ^
    6 errors generated.

This is because on FreeBSD, the pthread functions have lock annotations.
Since the functions in __thread_support are internal to libc++ only, add
no_thread_safety_analysis attributes to suppress these warnings.

Reviewers: mclow.lists, EricWF, delesley, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: ed, aaron.ballman, joerg, emaste, cfe-commits
Differential Revision: https://reviews.llvm.org/D28520

llvm-svn: 293197
2017-01-26 18:37:18 +00:00
Marshall Clow a98b5fd999 Fixed a couple of invalid statuses for 2665 and 2758
llvm-svn: 293179
2017-01-26 14:36:14 +00:00
Asiri Rathnayake e246350467 Fix chromium build (libcxx)
Remove the reference to pthread_mach_thread_np() in libcxx headers.

llvm-svn: 293167
2017-01-26 10:40:17 +00:00
Marshall Clow 3a3c09c5dd Use the new __has_feature(cxx_constexpr_string_builtins) for detection of the C-string intrinsics for constexpr support in std::char_traits. Thanks to Richard for the intrisic support.
llvm-svn: 293154
2017-01-26 06:58:29 +00:00
Marshall Clow 071aded6ee Fixed a typo in the synopsis (noecept -> noexcept). Thanks to Kim for the catch
llvm-svn: 293079
2017-01-25 20:14:03 +00:00
Mehdi Amini fd7165364b [libcxx] Mentions "targeting C++11 and above" instead of "targeting C++11" in the doc
llvm-svn: 293071
2017-01-25 17:00:30 +00:00
Marshall Clow 3cd9e94241 Implement LWG2556: Wide contract for future::share()
llvm-svn: 292992
2017-01-24 23:28:25 +00:00
Marshall Clow 63b560be69 Change the return type of emplace_[front|back] back to void when building with C++14 or before. Resolves PR31680.
llvm-svn: 292990
2017-01-24 23:09:12 +00:00
Marshall Clow e67179bc6c Remove auto_ptr in C++17. Get it back by defining _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
llvm-svn: 292986
2017-01-24 22:22:33 +00:00
Marshall Clow 86e7eae3a5 Add a test to make sure that implicit conversion from error_code to bool will fail
llvm-svn: 292969
2017-01-24 19:44:55 +00:00
Marshall Clow 1ee7bf6313 Update status for LWG2733
llvm-svn: 292967
2017-01-24 19:37:09 +00:00
Marshall Clow 0d1b5ce4f9 Implement LWG2733: [fund.ts.v2] gcd / lcm and bool. We already did tbis for C++17, so replicate the changes in experimental.
llvm-svn: 292962
2017-01-24 18:15:48 +00:00
Marshall Clow 77dd30b557 Mark LWG2736 as complete. No code changes, but we have more tests now
llvm-svn: 292958
2017-01-24 18:03:32 +00:00
Marshall Clow f56e3cdd5d A couple more tests for constexpr stuff in string_view. No changes other than test code.
llvm-svn: 292943
2017-01-24 16:28:02 +00:00
Eric Fiselier 89e41b49f6 Update Linux ABI lists to reflect inlining change in LLVM. More investigation tomorrow.
llvm-svn: 292929
2017-01-24 13:03:40 +00:00
Eric Fiselier f9e7bf3a43 Revert "[libcxx] Never use <cassert> within libc++"
This reverts commit r292883. Unfortunately <string_view> uses
_LIBCPP_ASSERT in a way which is not compatible with the C++11 dylib
build. I'll investigate more tomorrow.

llvm-svn: 292923
2017-01-24 12:26:01 +00:00
Eric Fiselier d591f17aad Revert yet another accidental change caused by r292684
llvm-svn: 292908
2017-01-24 10:38:46 +00:00
Eric Fiselier 5a6e718bd2 Fix bad XFAIL which recent LIT changes diagnosed
llvm-svn: 292905
2017-01-24 10:19:32 +00:00
Eric Fiselier bd23d4daac Remove all usages of REQUIRES-ANY in the test suite.
Pending LIT changes are about to remove the REQUIRES-ANY keyword
in place of supporting boolean && and || within "REQUIRES". This
patch prepares libc++ for that change so that when applied
the bots don't lose their mind.

llvm-svn: 292901
2017-01-24 09:11:08 +00:00
Eric Fiselier d5fd7d7ea1 [libcxx] Never use <cassert> within libc++
Summary:
It is my opinion that libc++ should never use `<cassert>`, including in the `dylib`. This patch remove all uses of `assert` from within libc++ and replaces most of them with `_LIBCPP_ASSERT` instead.

Additionally this patch turn `LIBCXX_ENABLE_ASSERTIONS`  off by default, because the standard library should not be aborting user programs unless explicitly asked to.

Reviewers: mclow.lists, compnerd, smeenai

Reviewed By: mclow.lists

Subscribers: mgorny, cfe-commits

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

llvm-svn: 292883
2017-01-24 04:57:33 +00:00
Eric Fiselier 014d9491ff Manually force the use of __decltype in C++03 with Clang 3.4.
<string> uses `decltype` in a way incompatible with `__typeof__`.
This is problematic when compiling <string> with Clang 3.4 because
even though it provides `__decltype` libc++ still used `__typeof__`
because clang 3.4 doesn't provide __is_identifier which libc++
uses to detect __decltype.

This patch manually detects Clang 3.4 and properly configures
for it.

llvm-svn: 292833
2017-01-23 21:41:13 +00:00
Eric Fiselier 5363be7a9c Fix GCC C++03 build by hiding default template argument in C++03
llvm-svn: 292830
2017-01-23 21:24:58 +00:00
Marshall Clow cddeb751a1 Implement LWG#2778: basic_string_view is missing constexpr.
llvm-svn: 292823
2017-01-23 19:53:28 +00:00
Marshall Clow c68c62c97f Fixed a typo in __config that prevented the aligned new/delete tests from passing on Mac OS.
llvm-svn: 292822
2017-01-23 19:51:54 +00:00
Marshall Clow 7a7d4cdb90 Revert previous cleanup; I got too agressive removing #ifdefs
llvm-svn: 292809
2017-01-23 18:00:15 +00:00
Marshall Clow faebbf7e4d Removed some un-needed ifdefs
llvm-svn: 292806
2017-01-23 17:25:38 +00:00
Eric Fiselier faa0d10b5a Revert accidentally changes which reverted r292582
llvm-svn: 292717
2017-01-21 14:42:44 +00:00
Eric Fiselier d9e1631d23 Fix recent build errors
llvm-svn: 292689
2017-01-21 00:57:29 +00:00
Eric Fiselier f9127593a9 Implement P0513R0 - "Poisoning the Hash"
Summary:
Exactly what the title says.

This patch also adds a `std::hash<nullptr_t>` specialization in C++17, but it was not added by this paper and I can't find the actual paper that adds it.

See http://wg21.link/P0513R0 for more info.

If there are no comments in the next couple of days I'll commit this

Reviewers: mclow.lists, K-ballo, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 292684
2017-01-21 00:02:12 +00:00
Eric Fiselier 78bfa04dbe Don't default older GCC's to C++17, but C++14 or C++11 instead
llvm-svn: 292607
2017-01-20 12:54:45 +00:00
Eric Fiselier d30625b1fd Revert "Don't default older GCC's to C++17, but C++14 or C++11 instead"
The commit isn't quite right, and I want to only have to merge one
commit into 4.0

llvm-svn: 292606
2017-01-20 12:52:59 +00:00
Eric Fiselier 2f121b664a Don't default older GCC's to C++17, but C++14 or C++11 instead
llvm-svn: 292605
2017-01-20 12:46:57 +00:00
Eric Fiselier 9114f45ab8 Still expose std::align_val_t in C++17 even if we don't have aligned new/delete.
r292564 disabled the aligned new/delete overloads on platforms without
posix_memalign. Unfortunately that patch also disabled the  align_val_t
definition in C++17 as well.

This patch causes align_val_t to be exposed in C++17 regardless
of if we have the new/delete overloads.

llvm-svn: 292582
2017-01-20 06:27:34 +00:00
Eric Fiselier ccf1813150 Refactor unique_ptr/shared_ptr deleter test types into single header.
llvm-svn: 292577
2017-01-20 04:39:17 +00:00
Eric Fiselier efea04512c Disable aligned new/delete on Apple platforms without posix_memalign
Summary:
This patch disables the aligned new/delet overloads on Apple platforms without `posix_memalign`. This fixes libc++.dylib build regressions on such platforms.
This fixes http://llvm.org/PR31448.

This patch should also be merged into the 4.0 release branch


Reviewers: mclow.lists, rsmith, dexonsmith, jeremyhu

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 292564
2017-01-20 01:47:26 +00:00
Eric Fiselier 24a2ebe677 [NFC] Group aligned new/delete definitions together in new.cpp
This patch is cleanup to prepare for future changes

llvm-svn: 292560
2017-01-20 01:13:49 +00:00
Eric Fiselier b26ed3924f Fix handling of Apple target triple when checking the ABI lists.
The check-cxx-abilist rule uses TARGET_TRIPLE to determine which
ABI list to check. However the triple on Apple contains the darwin
version which changes frequently, but libc++ doesn't need
different ABI lists for each darwin version.

This patch strips the minor version and patchlevel from TARGET_TRIPLE
before using it to determine the ABI list.

llvm-svn: 292557
2017-01-20 00:57:08 +00:00
Eric Fiselier d1e211a9ff Fix demangle helper after r286788
llvm-svn: 292541
2017-01-20 00:00:31 +00:00
Eric Fiselier b8c2a52266 Adjust msvc_stdlib_force_include.hpp to handle clang++
Summary: This patch adjusts the newly added `msvc_stdlib_force_include.hpp` so that it also works when used with `clang++`.

Reviewers: STL_MSFT

Reviewed By: STL_MSFT

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

llvm-svn: 292539
2017-01-19 23:48:05 +00:00
Marshall Clow c3cb054e0c Mark two of the TS implementations as 'in progress'
llvm-svn: 292490
2017-01-19 15:30:36 +00:00
Stephan T. Lavavej d6c0b35c11 [libcxx] [test] Add msvc_stdlib_force_include.hpp.
No functional change; nothing includes this, instead our test harness
injects it via the /FI compiler option.

No code review; blessed in advance by EricWF.

llvm-svn: 292443
2017-01-18 22:19:14 +00:00
Stephan T. Lavavej a730ed3149 [libcxx] [test] Fix comment typos, strip trailing whitespace.
No functional change, no code review.

llvm-svn: 292434
2017-01-18 20:10:25 +00:00
Stephan T. Lavavej 3d26ee2921 [libcxx] [test] Fix MSVC warnings C4127 and C6326 about constants.
MSVC has compiler warnings C4127 "conditional expression is constant" (enabled
by /W4) and C6326 "Potential comparison of a constant with another constant"
(enabled by /analyze). They're potentially useful, although they're slightly
annoying to library devs who know what they're doing. In the latest version of
the compiler, C4127 is suppressed when the compiler sees simple tests like
"if (name_of_thing)", so extracting comparison expressions into named
constants is a workaround. At the same time, using std::integral_constant
avoids C6326, which doesn't look at template arguments.

test/std/containers/sequences/vector.bool/emplace.pass.cpp
Replace 1 == 1 with true, which is the same as far as the library is concerned.

Fixes D28837.

llvm-svn: 292432
2017-01-18 20:09:56 +00:00
Eric Fiselier 1301915aeb Re-add mechanism to override LIT options using enviroment variables.
There was a dumb mistake in the original commit that has now
been fixed

llvm-svn: 292351
2017-01-18 07:56:57 +00:00
Eric Fiselier 3dd2abb0b8 Revert "Add mechanism to override LIT options using enviroment variables"
The buildbots currently depend on the old configuration. I'll recommit
once Zorg is fixed and reset

llvm-svn: 292347
2017-01-18 06:24:18 +00:00
Eric Fiselier bbcf944abf Add mechanism to override LIT options using enviroment variables
llvm-svn: 292346
2017-01-18 06:08:38 +00:00
Eric Fiselier 337a7c542d Fix filesystem::path assignment from {}
Adding `path::operator=(string_type&&)` made the expression `p = {}`
ambiguous. This path fixes that ambiguity by making the `string&&`
overload a template so it ranks lower during overload resolution.

llvm-svn: 292345
2017-01-18 05:48:55 +00:00
Eric Fiselier 673c5f9cea Get more std::string _LIBCPP_DEBUG tests passing
llvm-svn: 292342
2017-01-18 05:34:42 +00:00
Eric Fiselier 4f5f8967eb More configuration changes for running the test suite against MSVC's STL
llvm-svn: 292337
2017-01-18 03:57:38 +00:00
Eric Fiselier ae2c8de6bf Add support for running our test suite against MSVC's STL
llvm-svn: 292326
2017-01-18 01:48:54 +00:00
Eric Fiselier 1da55f532c Allow sym_diff.py to report non-zero for non-breaking ABI changes
llvm-svn: 292297
2017-01-18 00:05:01 +00:00
Eric Fiselier 6880885fae Fix type_info's constructor by making it explicit again.
In recent changes type_info's private constructor was
accidentally made implicit. This patch fixes that.

llvm-svn: 292294
2017-01-17 23:41:42 +00:00
Eric Fiselier 6dede18cb1 Don't strip -m32 from the user provide command line flags. This fixes the compiler-rt 32 bit sanitizer build
llvm-svn: 292291
2017-01-17 23:27:56 +00:00
Stephan T. Lavavej 6d184d1fb1 [libcxx] [test] Don't ask whether Incomplete& can be assigned to.
This is the subject of an active NB comment. Regardless of what the Working
Paper currently says, asking this question is morally wrong, because the
answer can change when the type is completed. C1XX now detects such
precondition violations and complains about them; perhaps Clang should too.

Fixes D28591.

llvm-svn: 292281
2017-01-17 22:24:45 +00:00
Eric Fiselier 38590b3845 Fix std::string assignment ambiguity from braced initializer lists.
When support for `basic_string_view` was added to string it also
added new assignment operators from `basic_string_view`. These caused
ambiguity when assigning from a braced initializer. This patch fixes
that regression by making the basic_string_view assignment operator
rank lower in overload resolution by making it a template.

llvm-svn: 292276
2017-01-17 22:10:32 +00:00
Eric Fiselier 11f6045379 Add ABI option to remove recently inlined __shared_count functions from the library.
In order to allow inlining of previously out-of-line functions without an ABI break
libc++ provides legacy definitions in the dylib that old programs can
continue to use. Unfortunatly Windows link.exe detects this hack and diagnoses the duplicate
definitions.

This patch disable the duplicate definitions on Windows by adding an ABI option
which disables all "legacy out-of-line symbols"

llvm-svn: 292190
2017-01-17 03:16:26 +00:00
Eric Fiselier a480c28b3c Fix DLL build by removing _LIBCPP_FUNC_VIS from member of class marked dllexport
llvm-svn: 292185
2017-01-17 03:05:31 +00:00
Kevin Hu f08de52d77 [Test patch] Inline hot functions in libcxx shared_ptr
Moves hot functions such as atomic add into the memory header file
so that they can be inlined, which brings performance benefits.

Patch by Kevin Hu, Aditya Kumar, Sebastian Pop

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

llvm-svn: 292184
2017-01-17 02:46:33 +00:00
Eric Fiselier 45c4dbf620 Add warning messages to buildit/testit about their upcoming removal
llvm-svn: 292181
2017-01-17 01:16:44 +00:00
Eric Fiselier ca0e501cdc Rename new_handler in tests to avoid conflicts with MSVC symbols.
On Windows the header new.h defines "new_handler" in the global
namespace.

llvm-svn: 292177
2017-01-17 00:32:08 +00:00
Eric Fiselier b43f17c835 Fix std::tuples EBO when targeting the MSVC ABI.
MSVC/clang-cl doesn't do a full EBO unless __declspec(empty_bases)
is applied to the derived type. This causes certain tuple tests
to fail.

This patch adds the empty_bases attribute to __tuple_impl in order
for tuple to fully provide the EBO.

llvm-svn: 292159
2017-01-16 21:15:08 +00:00
Eric Fiselier fc26379a84 [libc++] Introduce _LIBCPP_EXTERN_VIS to fix __libcpp_debug_function link errors
Summary: On Windows tests that use `_LIBCPP_ASSERT` fail to link because the assertion handler function isn't correctly exported from the libc++ dylib. This patch fixes the dll import/export issues by introducing a new visibility macro `_LIBCPP_EXTERN_VIS` for use on external variables.

Reviewers: compnerd, smeenai, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 292158
2017-01-16 21:01:00 +00:00
Eric Fiselier 1cd196e7b4 Improve CMake and LIT support for Windows
This patch contains multiple cleanups and fixes to better support building on
Windows.

* [Test] Fix handling of library runtime search paths by correctly adding them
  to the PATH variable when running the tests.

* [Test] Don't explicitly force "--target=i686-pc-windows" when running the
  test suite. Clang++ seems to deduce the correct target.

* [Test] Fix `.sh.cpp` tests on Windows by properly escaping flags used in
  shell commands. Specifically windows style paths which included spaces
  were causing these tests to fail.

* [CMake] Add "vcruntime" to the list of supported C++ ABI libraries in CMake, and
  teach the test suite how to handle it. For now libc++ defaults to using
  "vcruntime" on Windows except when libc++abi is in tree; That is probably
  a bug and should be changed to always use vcruntime, at least for now.

* [Misc] Move the "c++-build" include directory to the libc++ binary dir
  instead of the top level project dir and rename it "c++build". This is just
  misc cleanup. Libc++ shouldn't be creating internal build files and directories
  at the top-level projects root.

* [Misc] Build type_info's destructor when building for MSVC. This is a temporary
  work around to prevent link errors until we have a proper type_info
  implementation.

llvm-svn: 292157
2017-01-16 20:47:35 +00:00
Eric Fiselier a0aa6c3c80 Make sym_check python 3 compatible
llvm-svn: 292152
2017-01-16 19:52:58 +00:00
Asiri Rathnayake 52fe25053c [libcxx] Follow-up to r292107
I've missed a couple of updates. NFC.

llvm-svn: 292109
2017-01-16 13:13:01 +00:00
Asiri Rathnayake e3d832a3e8 [libcxx] Improve design documentation for the external-thread-library
configuration

NFC.

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

Reviewers: EricWF
llvm-svn: 292108
2017-01-16 12:44:08 +00:00
Asiri Rathnayake af762e91b2 [libcxx] Don't assume __libcpp_thread_t is an integral type
We have already refactored the underlying platform thread type into
__libcpp_thread_t, but there are few places in the source where we
still assume it is an integral type.

This patch refactores those points back into the threading API.

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

Reviewers: EricWF
llvm-svn: 292107
2017-01-16 12:19:54 +00:00
Michael Park f4770ea983 Added a workaround for a `-fdelayed-template-parsing` bug.
Summary:
There seems to be an additional bug in `-fdelayed-template-parsing`
similar to
http://llvm.org/viewvc/llvm-project?view=revision&revision=236063.

This is a workaround for it for <variant> to compile with `clang-cl` on Windows.

Reviewers: EricWF

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

llvm-svn: 292097
2017-01-16 08:14:25 +00:00