Commit Graph

5566 Commits

Author SHA1 Message Date
Louis Dionne fa0573027f [libc++] Mark <filesystem> as unavailable on Apple platforms using pragmas
Summary:
Also add the corresponding XFAILs to tests that require filesystem.
The approach taken to mark <filesystem> as unavailable in this patch
is to mark all the header as unavailable using #pragma clang attribute.
Marking each declaration using the attribute is more intrusive and
does not provide a lot of value right now because pretty much everything
in <filesystem> requires dylib support, often transitively.

This is an alternative to https://reviews.llvm.org/D59093.
A similar (but partial) patch was already applied in r356558.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 356616
2019-03-20 21:18:14 +00:00
Marshall Clow 61914dc2fe Mark <charconv> tests as unsupported for C++11 and C++14 if you're not testing libc++. Thanks to Louis for the suggestion.
llvm-svn: 356602
2019-03-20 19:43:22 +00:00
Louis Dionne 6f3b566c87 [libc++] Use the compiler that CMake found when running lit for back-deployment tests
llvm-svn: 356595
2019-03-20 19:12:27 +00:00
Louis Dionne 2d0b4d6bb3 [libc++][CMake] Clean up some of the libc++ re-exporting logic
Summary:
This change allows specifying the version of libc++abi's ABI to re-export
when configuring CMake. It also clearly identifies which ABI version of
libc++abi each export file contains.

Finally, it removes hardcoded knowledge about the 10.9 SDK for MacOS,
since that knowledge is not relevant anymore. Indeed, libc++ can't be
built with the toolchain that came with the 10.9 SDK anyway because
the version of Clang it includes is too old (for example if you want
to build a working libc++.dylib, you need bugfixes to visibility
attributes that are only in recent Clangs).

Reviewers: dexonsmith, EricWF

Subscribers: mgorny, christof, jkorous, arphaman, libcxx-commits

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

llvm-svn: 356587
2019-03-20 18:16:24 +00:00
Marshall Clow 769c2459d5 Make to_chars/from_chars work back to C++11. This means that we can use them to implement to_string as well. Reviewed as https://reviews.llvm.org/D59598.
llvm-svn: 356585
2019-03-20 18:13:23 +00:00
Louis Dionne 77bca6d296 [NFC] Fix a couple of typos in libc++'s __config
llvm-svn: 356574
2019-03-20 17:05:52 +00:00
Louis Dionne e526a6bd55 [libc++] Do not force going through xcrun to find Clang in the macOS CI scripts
It should be possible to run those CI scripts with different compilers
by simply exporting a different CXX environment variable.

llvm-svn: 356562
2019-03-20 15:40:56 +00:00
Louis Dionne b38c08ac02 [libc++] Mark <filesystem> tests as failing when the dylib doesn't support filesystem
This fixes CI for back-deployment testers on platforms that don't have
<filesystem> support in the dylib.

This is effectively half of https://reviews.llvm.org/D59224. The other
half requires fixes in Clang.

llvm-svn: 356558
2019-03-20 14:34:00 +00:00
Louis Dionne 4d03bbbb3a [libc++] Flag file_clock test as expected to fail with ASAN
This silences a known issue, as can be seen by looking at similar
tests for other clocks, like time.clock.steady/consistency.pass.cpp.

llvm-svn: 356528
2019-03-19 21:53:32 +00:00
Louis Dionne 2b27c00102 [libc++] Complete the ABI changelog after landing <filesystem> in the dylib
llvm-svn: 356523
2019-03-19 21:32:37 +00:00
Louis Dionne cc37af7a36 [libc++] Build <filesystem> support as part of the dylib
Summary:
This patch treats <filesystem> as a first-class citizen of the dylib,
like all other sub-libraries (e.g. <chrono>). As such, it also removes
all special handling for installing the filesystem library separately
or disabling part of the test suite from the lit command line.

Unlike the previous attempt (r356500), this doesn't remove all the
filesystem tests.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, jdoerfert, libcxx-commits

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

llvm-svn: 356518
2019-03-19 20:56:13 +00:00
Thomas Anderson a0feccdf56 [libc++] Speed up certain locale functions on Windows
The issue is that __libcpp_locale_guard makes some slow calls to setlocale().
This change avoids using __libcpp_locale_guard in snprintf_l().

Fixes https://bugs.llvm.org/show_bug.cgi?id=41131

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

llvm-svn: 356512
2019-03-19 20:30:58 +00:00
Louis Dionne f7b43230b8 Revert "[libc++] Build <filesystem> support as part of the dylib"
When I applied r356500 (https://reviews.llvm.org/D59152), I somehow
deleted all of filesystem's tests. I will revert r356500 and re-apply
it properly.

llvm-svn: 356505
2019-03-19 19:27:29 +00:00
JF Bastien d81df259b3 Fix char.traits.specializations.char8_t main return
llvm-svn: 356504
2019-03-19 19:25:07 +00:00
Eric Fiselier 9b7685d545 Fixup ABI lists on Linux after adding <filesystem> to the dylib.
llvm-svn: 356503
2019-03-19 19:20:43 +00:00
Eric Fiselier 33244990ad Add visibility attributes and inline to some vector methods.
Adding filesystem to the dylib caused some vector symbols to leak
into the set of exported symbols. This patch hides those symbols.

llvm-svn: 356502
2019-03-19 19:19:44 +00:00
Louis Dionne 72122d058b [libc++] Build <filesystem> support as part of the dylib
Summary:
This patch treats <filesystem> as a first-class citizen of the dylib,
like all other sub-libraries (e.g. <chrono>). As such, it also removes
all special handling for installing the filesystem library separately
or disabling part of the test suite from the lit command line.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, jdoerfert, libcxx-commits

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

llvm-svn: 356500
2019-03-19 19:09:33 +00:00
JF Bastien c3608fc0d6 Fix fenv.pass.cpp signature for main
And make main return.

llvm-svn: 356493
2019-03-19 18:24:11 +00:00
Louis Dionne afd1a23ffb [libc++] Mark internal types of std::filesystem as hidden
Summary:
Otherwise, implicit instantiations of templates with these types can
cause the dylib to start exporting the vtable/RTTI of the instantiation.
Giving hidden visibility to those types causes the compiler to understand
that they are not used outside the dylib, and as a result implicitly
instantiated vtables/RTTI of templates with those internal types will
get hidden visibility.

Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, jdoerfert, libcxx-commits

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

llvm-svn: 356488
2019-03-19 17:47:53 +00:00
Marshall Clow 9ea0e473f0 Mark 'front()' and 'back()' as noexcept for array/deque/string/string_view. These are just rebranded 'operator[]', and should be noexcept like it is.
llvm-svn: 356435
2019-03-19 03:30:07 +00:00
Eric Fiselier 0f8041b6e2 Remove unused try catch blocks from old debug tests
llvm-svn: 356429
2019-03-19 00:00:30 +00:00
Eric Fiselier cc703de62f Fix test failures after debug mode changes
llvm-svn: 356421
2019-03-18 22:12:09 +00:00
Eric Fiselier 61b302f94f Remove exception throwing debug mode handler support.
Summary:
The reason libc++ implemented a throwing debug mode handler was for ease of testing. Specifically,
I thought that if a debug violation aborted, we could only test one violation per file. This made
it impossible to test debug mode. Which throwing behavior we could test more!

However, the throwing approach didn't work either, since there are debug violations underneath noexcept
functions. This lead to the introduction of `_NOEXCEPT_DEBUG`, which was only noexcept when debug
mode was off.

Having thought more and having grown wiser, `_NOEXCEPT_DEBUG` was a horrible decision. It was
viral, it didn't cover all the cases it needed to, and it was observable to the user -- at worst
changing the behavior of their program.

  This patch removes the throwing debug handler, and rewrites the debug tests using 'fork-ing' style
  death tests.

Reviewers: mclow.lists, ldionne, thomasanderson

Reviewed By: ldionne

Subscribers: christof, arphaman, libcxx-commits, #libc

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

llvm-svn: 356417
2019-03-18 21:50:12 +00:00
Louis Dionne 0c962cb5c8 [libc++][NFC] Promote CMake comment to an actual option description
llvm-svn: 356386
2019-03-18 18:18:01 +00:00
Louis Dionne 2bde5303c7 [libc++] Add a test for PR40977
Even though the header makes the exact same check since https://llvm.org/D59063,
the headers could conceivably change in the future and introduce a bug.

llvm-svn: 356376
2019-03-18 15:40:49 +00:00
Marshall Clow 2fa901c471 Update a deque test with more assertions. NFC
llvm-svn: 356266
2019-03-15 15:00:41 +00:00
Marshall Clow 5bcca9ffd1 Mark vector::operator[] and front/back as noexcept. We already do this for string and string_view. This should give better codegen inside of noexcept functions. Add tests for op[]/front/back/at, because apparently we had none.
llvm-svn: 356224
2019-03-15 00:29:35 +00:00
Marshall Clow 3068500aa7 XFAIL this debug-mode test that I just broke. Eric has a patch out for review (D59166) that rewrites this test completely, so I'm not going to bother fixing it.
llvm-svn: 356211
2019-03-14 22:24:32 +00:00
Marshall Clow 5f6a5ac19c Add noexcept to operator[] for array and deque. This is an extension. We already do this for string and string_view. This should give better codegen inside of noexcept functions.
llvm-svn: 356209
2019-03-14 21:56:57 +00:00
Marshall Clow 0d8df98328 Reorg the midpoint pointer test into runtime and constexpr tests; comment out the volatile constexpr tests for GCC because our experimental gcc bot barfs on them.
llvm-svn: 356177
2019-03-14 17:43:41 +00:00
Marshall Clow 6f8dddf169 Fix two of the three bot failures for midpoint; the ones regarding the lack of '__int128_t'
llvm-svn: 356169
2019-03-14 17:20:02 +00:00
Louis Dionne 702411fc29 [libc++][CMake] Do not define `cxx_shared_EXPORTS` when building the shared library
CMake will define -Dcxx_shared_EXPORTS when building the shared library
by default. In theory, this is used to signal to the library that we're
building a shared library and that dllimport/dllexport should be used.
However, we already have our own way of doing that, so I'm removing this
define to avoid meaningless command line arguments in the build.

llvm-svn: 356167
2019-03-14 17:15:47 +00:00
Marshall Clow 330ab33f7c Add std::midpoint for integral and poiner types. Described in P0811, reviewed as D59099.
llvm-svn: 356162
2019-03-14 16:25:55 +00:00
Louis Dionne 850a3d3b92 [libc++][CMake] Fix typo introduced in r356150
That typo broke the build when the shared library build was disabled.

llvm-svn: 356155
2019-03-14 14:52:26 +00:00
Louis Dionne 30f305efe2 [libc++] Do not force building with -fPIC (re-applying)
Summary:
In r355746, we stopped forcing to build with -fPIC because that should
be specified by the CMAKE_POSITION_INDEPENDENT_CODE option at CMake
configure time (and by default -fPIC is used for shared libraries anyways).

However, r355746 had to be reverted in r355756 because we were not
actually building the shared library with -fPIC. The reason is that
we were sharing an object library between the static and the shared
library, which caused flags for static libraries to be used when
building object files that were going to be used for a shared library.

Since this was resolved by r356150, we can stop forcing -fPIC again.

Reviewers: EricWF, smeenai

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 356153
2019-03-14 14:38:38 +00:00
Louis Dionne 989eca62c6 [libc++] Do not share an object library to create the static/shared libraries
Summary:
The problem with using an object library for doing this is that it prevents
the shared library and the static library from being built with the right
default flags. For example, CMake will build shared libraries with -fPIC
by default, but not static libraries. Using an object library to create
the shared library will prevent the right default flags for shared
libraries from being used.

As a side effect, this patch also localizes the logic related to building
a hermetic static library to the static library case, making clear that
this has no effect on the shared library.

Reviewers: phosek, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, jdoerfert, libcxx-commits

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

llvm-svn: 356150
2019-03-14 14:19:08 +00:00
Eric Fiselier dfce2dd21e Properly constrain basic_string(Iter, Iter, Alloc = A())
llvm-svn: 356140
2019-03-14 12:31:10 +00:00
Louis Dionne a470a13a70 [libc++] Enable deprecation warnings by default
Summary:
In r342843, I added deprecation warnings to some facilities that were
deprectated in C++14 and C++17. However, those deprecation warnings
were not enabled by default.

After discussing this on IRC, we had finally gotten consensus to enable
those warnings by default, and I'm getting around to doing that only
now.

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, jdoerfert, libcxx-commits

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

llvm-svn: 355961
2019-03-12 20:10:06 +00:00
Eric Fiselier 86af6f5088 Allow optional to tolerate being used with a nested class.
When Clang tries to complete a type containing `std::optional` it
considers the `in_place_t` constructor with no arguments which checks
if the value type is default constructible. If the value type is a
nested class type, then this check occurs too early and poisons the
is_default_constructible trait.

This patch makes optional deduce `in_place_t` so we can prevent
this early SFINAE evaluation. Technically this could break people
doing weird things with the in_place_t tag, but that seems less
important than making the nested class case work.

llvm-svn: 355877
2019-03-11 22:55:21 +00:00
Louis Dionne 3836a49039 [libc++] Remove empty header xlocale/xlocale.h
Summary:
I can't think of a reason for shipping this empty header. If there is
a reason to do so, then hopefully this review can uncover it.

Reviewers: mclow.lists, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 355829
2019-03-11 15:41:51 +00:00
Eric Fiselier 7ffcd984c4 LWG 2843 "Unclear behavior of std::pmr::memory_resource::do_allocate()"
Patch by Arthur O'Dwyer.
Reviewed as https://reviews.llvm.org/D47344

new_delete_resource().allocate(n, a) has basically two permissible results:

* Return an appropriately sized and aligned block.
* Throw bad_alloc.

Before this patch, libc++'s new_delete_resource would do a third and impermissible thing, which was
to return an appropriately sized but inappropriately under-aligned block. This is now fixed.

(This came up while I was stress-testing unsynchronized_pool_resource on my MacBook. If we can't
trust the default resource to return appropriately aligned blocks, pretty much everything breaks.
For similar reasons, I would strongly support just patching __libcpp_allocate directly, but I don't
care to die on that hill, so I made this patch as a <memory_resource>-specific workaround.)

llvm-svn: 355763
2019-03-09 00:38:19 +00:00
Eric Fiselier 411210838d Work around dllimport bug with exclude_from_explicit_instantiation.
When dllimport is specified on a class, and
exclude_from_explicit_instatiation is specified on a member, clang-cl
will still expect a definition to be available externally. But this is
not correct.

Surprisingly one one symbol seems to be consistently affected by this
bug. So this patch simply works around it there.

llvm-svn: 355760
2019-03-08 23:59:29 +00:00
Eric Fiselier 3e3d6c9038 Fix C++03 build failure
llvm-svn: 355758
2019-03-08 23:30:26 +00:00
Eric Fiselier 9dd9495a35 Revert "[libc++] Do not force building with -fPIC"
This reverts commit r355764.

CMake does not turn -fPIC on for us by default. so this patch breaks
standalone builds. The only reason it hasn't broken any bots is because
LLVM turns on and specifies '-fPIC' for us.

llvm-svn: 355756
2019-03-08 23:27:46 +00:00
Eric Fiselier 0e1586c4fb Unbork `std::memory_order` ABI.
Summary:
We need to pin the underlying type of C++20' `std::memory_order` to match the C++17 version. Anything less is an ABI break.

At the moment it's `unsigned` before C++20 and `int` after. Or if you're using `-fshort-enums` it's `unsigned char` before C++20 and `int` after.

This patch explicitly specifies the underlying type of the  C++20 `memory_order` to be w/e type the compiler would have chosen for the C++17 version.

Reviewers: mclow.lists, ldionne

Reviewed By: ldionne

Subscribers: jfb, jdoerfert, #libc, zoecarver

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

llvm-svn: 355755
2019-03-08 23:15:54 +00:00
Eric Fiselier 6e4ec6022f Fix PR41017 - Build failure with _LIBCPP_DEBUG=0 and non-const-ref
comparator for std::sort()

Our debug comparator assumed that the comparator it wraps would always
accepts the values by const ref. This isn't required by the standard.

This patch makes our __debug_less comparator forward the constness.

llvm-svn: 355752
2019-03-08 22:58:59 +00:00
Louis Dionne 2714d58901 [libc++] Do not force building with -fPIC
Summary:
Whether we build with -fPIC should be specified by the
CMAKE_POSITION_INDEPENDENT_CODE option at configure time.
Note that this patch doesn't change the behavior when building
by default, since -fPIC is used for shared libraries by default.

Reviewers: EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 355746
2019-03-08 22:24:12 +00:00
Louis Dionne 3d678b5336 [NFC] Add missing revision information to ABI Changelog
llvm-svn: 355732
2019-03-08 21:01:25 +00:00
Matthew Voss 1262e52e16 Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"
This broke the windows bots.

This reverts commit 28302c66d2.

llvm-svn: 355725
2019-03-08 20:33:55 +00:00
Petr Hosek 28302c66d2 [runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/
This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory.  Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/<target> and include/ directories, leaving resource directory only
for compiler-rt runtimes and Clang builtin headers.

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

llvm-svn: 355665
2019-03-08 05:35:22 +00:00
Thomas Anderson 516d07de07 [libc++] Fix use-after-free when building with _LIBCPP_DEBUG=1
The issue is the following code:

    __cn1->__add(*__ip);
    (*__ip)->__c_ = __cn1;

`__ip` points into the array of iterators for container `__cn2`.  This code adds
the iterator to the array of iterators for `__cn1`, and updates the iterator to
point to the new container.

This code works fine, except when `__cn1` and `__cn2` are the same container.
`__cn1->__add()` might need to grow the array of iterators, and when it does,
`__ip` becomes invalid, so the second line becomes a use-after-free error.

Simply swapping the order of the above two lines is not sufficient, because of
the memmove() below.  The easiest and most performant solution is just to skip
touching any iterators if the containers are the same.

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

llvm-svn: 355550
2019-03-06 21:10:08 +00:00
Eric Fiselier 2710d8e105 Fix ABI compatibility of `<stdexcept>` with VCRuntime.
Summary:
Currently, libc++'s `<stdexcept>` doesn't play nice with `vcruntime`. Specifically:

* `logic_error` and `runtime_error` have a different layout.
* libc++'s `logic_error` and `runtime_error` override `what()` but `vcruntime` does not.
*  `vcruntime` uses weak vtables for `<stdexcept>` types.
* libc++'s `<stdexcept>` constructors and assignment operators may have different manglings than `vcruntimes`.

This patch makes libc++'s declarations in `<stdexcept>` match those provided by MSVC's STL as closely as possible.
If MSVC doesn't declare a special member, then neither do we. This ensures that the implicit definitions have the same linkage, visibility, triviality, and noexcept-ness.







Reviewers: thomasanderson, ldionne, smeenai

Reviewed By: thomasanderson

Subscribers: jdoerfert, libcxx-commits

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

llvm-svn: 355546
2019-03-06 20:31:57 +00:00
Louis Dionne 930007ba76 [libc++] Do not specify the underlying type of memory_order
Summary:
This breaks ABI for folks using -fshort-enums, and does not really buy
us anything.

http://llvm.org/PR40977

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, zoecarver

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

llvm-svn: 355521
2019-03-06 17:07:24 +00:00
Marshall Clow 8eda3ad29d Eradicate all the ptrdiff_ts in span left over from applying P1227. A couple of other minor cleanups. NFC
llvm-svn: 355481
2019-03-06 03:59:44 +00:00
Louis Dionne bbdddb7b0e [libc++] Only add dylib-related features when using the system's libc++
Otherwise, when testing trunk libc++ on an older system, lit will think
that the dylib features are disabled. Ideally, we'd have a notion of
running the tests with/without a deployment target (or, equivalently,
a deployment target representing trunk where everything is as recent
as can be). Since we always have a deployment target right now (which
defaults to the current system), we only enable those features when
we're going to also be testing with the system libc++.

We also need to disable the availability markup when we are not running
a system library flavor, because availability markup does not make sense
when building against the trunk libc++ (which has everything regardless
of what the current system is).

This is a re-application of r353319, which had been reverted due to
CI breakage. This time around, I made sure it didn't break our internal
CI before submitting.

This is also a partial undoing of r348296, in spirit at least. However,
with this patch, availability markup is enabled based on whether we're
using a system library or not, whereas previously one could enable
it or disable it arbitrarily. This was confusing as it led to testing
configurations that don't make sense (such as testing a system library
without availability markup, or trunk testing with availability markup).

llvm-svn: 355451
2019-03-05 22:42:45 +00:00
Davide Italiano 6de760ac4e Reinstate libc++ patches now that the lldb formatter has been updated.
"[libc++] Fix <atomic> failures on GCC"
"[libc++] Change memory_order to an enum class"
"[libc++] decoupling Freestanding atomic<T> from libatomic.a"

llvm-svn: 355427
2019-03-05 18:40:49 +00:00
Davide Italiano 1061cb6a93 [libcxx] Revert set of atomic patches that broke lldb.
Revert "[libc++] Fix <atomic> failures on GCC"
Revert "[libc++] Change memory_order to an enum class"
Revert "[libc++] decoupling Freestanding atomic<T> from libatomic.a"

The lldb formatter nededs to be updated. Shafik and Louis will
coordinate to do so.

llvm-svn: 355417
2019-03-05 17:38:33 +00:00
Louis Dionne 130322e7cc [libc++] Fix <atomic> failures on GCC
Summary:
In https://reviews.llvm.org/D58201, we turned memory_order into an enum
class in C++20 mode. However, we were not casting memory_order to its
underlying type correctly for the GCC implementation, which broke the
build bots. I also fixed a test that was failing in C++17 mode on GCC 5.

Reviewers: EricWF, jfb, mclow.lists

Subscribers: zoecarver

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

llvm-svn: 355409
2019-03-05 15:49:58 +00:00
Louis Dionne b55803283b [libc++] Change memory_order to an enum class
This implements P0439R0.

Thanks to Zoe Carver for the patch.
Differential Revision: https://reviews.llvm.org/D58201

llvm-svn: 355403
2019-03-05 14:50:25 +00:00
Eric Fiselier 1c014d75b4 Fix -fsanitize=vptr badness in <__debug>
Summary:

This patch fixes a lifetime bug when inserting a new container into the debug database. It is
diagnosed by UBSAN when debug mode is enabled. This patch corrects how nodes are constructed
during insertion.

The fix requires unconditionally breaking the debug mode ABI. Users should not expect ABI
stability from debug mode.

Reviewers: ldionne, serge-sans-paille, EricWF

Reviewed By: EricWF

Subscribers: mclow.lists, christof, libcxx-commits

Tags: #libc

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

llvm-svn: 355367
2019-03-05 02:10:31 +00:00
Eric Fiselier e69290dc7f Make VCRuntime ABI configuration a first-class option.
Summary:
On Windows we currently provide two separate ABI configurations. One which defers to `vcruntime` to provide the C++ runtime and another which doesn't.
Using `vcruntime` allows interoperability which programs compiled against the MSVC STL, and should be preferred whenever possible.

When deferring to `vcruntime` much of the ABI we provide changes. Including the layout of `<stdexcept>` types, their vtables, and how the linkage of their members.

This patch introduces the `_LIBCPP_ABI_VCRUNTIME` macro to denote this configuration. It also cleans up the existing configuration for using `vcruntime`.

This cleanup lays the groundwork for fixing a number of ABI and interoperability bugs in  `<stdexcept>`.


Reviewers: thomasanderson, ldionne, smeenai

Reviewed By: smeenai

Subscribers: jdoerfert, libcxx-commits, #libc

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

llvm-svn: 355366
2019-03-05 01:57:01 +00:00
Louis Dionne fc778fa2c5 [libc++] Remove old CMake workaround
We haven't had any complaints so far, and I don't think anybody builds
libc++ from source for that old platform anymore.

llvm-svn: 355336
2019-03-04 20:52:14 +00:00
Eric Fiselier 8b73ab29c3 Install GCC 5 on buildbots to replace GCC 4.9.
LLVM is dropping support for GCC 4.9. This patch adds
a GCC 5 installation to the buildbot image so we can upgrade
the 4.9 bot to GCC 5.

As a temporary workaround until zorg updates, we install GCC 5
as GCC 4.9.

llvm-svn: 355334
2019-03-04 20:49:18 +00:00
Louis Dionne 21450545d1 [libc++] decoupling Freestanding atomic<T> from libatomic.a
This patch introduces non-lockfree atomics that do not require using
an external libatomic. This work is done with the long-term goal of
allowing the use of <atomic> in freestanding environments.

Thanks to Olivier Giroux for the patch.
Differential Revision: https://reviews.llvm.org/D56913

llvm-svn: 355318
2019-03-04 15:26:27 +00:00
Louis Dionne afde07ce97 [libc++] Fix forgotten fclose() in unit test
Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D58732

llvm-svn: 355162
2019-03-01 01:32:44 +00:00
Louis Dionne e90085029c [libc++] Increase portability of xalloc test
Do not assume that xalloc() starts at 0, which is not specified by the
Standard.

Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D58299

llvm-svn: 355160
2019-03-01 00:51:54 +00:00
Louis Dionne 4fcdf21406 [NFC][libc++] Update comment about oldest supported macosx for back-deployment
llvm-svn: 355043
2019-02-27 23:36:22 +00:00
Louis Dionne ab19068b7f [libc++] Add is_nothrow_convertible from P0758R1
Reviewed as https://reviews.llvm.org/D58019.
Thanks to Zoe Carver for the patch.

llvm-svn: 355010
2019-02-27 17:57:38 +00:00
Louis Dionne 1be935f418 [libc++] Remove visibility-related warnings with Clang 8
The attributes were placed incorrectly -- they need to be after the
"struct" keyword, not before.

llvm-svn: 355006
2019-02-27 17:33:25 +00:00
Marshall Clow 5c814099c7 I changed a 'enable_if<...>::type to' 'enable_if_t<...>' but forgot to remove the preceding 'typename'
llvm-svn: 354995
2019-02-27 16:09:35 +00:00
Marshall Clow 02e1651c1f Implment the last part of P1024: tuple-like interface to span. Reviewed as https://reviews.llvm.org/D58706.
llvm-svn: 354988
2019-02-27 15:41:37 +00:00
Marshall Clow 2ffa170515 In the review of D58642, Louis asked: 'Is there a reason for making this inline? Templates are already inline by default'. I told him that I didn't want to change the one call (ssize) that I was adding, but would come back later and clean them all (data/empty/begin/end/cbegin/cend/rbegin/rend/crbegin/crend/size/ssize) up later. Now it is later. Remove the unnecessary 'inline' modifiers from all these calls.
llvm-svn: 354952
2019-02-27 03:25:43 +00:00
Marshall Clow 7d3986ea30 Implement the second part of P1227R2 - Signed ssize() functions. Reviewed as https://reviews.llvm.org/D58642
llvm-svn: 354950
2019-02-27 02:58:56 +00:00
Marshall Clow ded9f0efad Fix an ambiguity in the tests that gcc-tot complained about.
llvm-svn: 354944
2019-02-27 01:29:52 +00:00
Louis Dionne 62f3900715 [libc++] Add a test for PR14074
PR14074 was fixed in r165884, but no tests were added.

llvm-svn: 354943
2019-02-27 01:29:09 +00:00
Louis Dionne 25838c6dac [libc++] Mark several tests as XFAIL on macosx10.7
Those tests fail when linking against a new dylib but running against
macosx10.7. I believe this is caused by a duplicate definition of the
RTTI for exception classes in libc++.dylib and libc++abi.dylib, but
this matter still needs some investigation.

This issue was not caught previously because all the tests always linked
against the same dylib used for running (because LIT made it impossible
to do otherwise before r349171).

rdar://problem/46809586

llvm-svn: 354940
2019-02-27 00:57:57 +00:00
Marshall Clow 7ad06a9319 First part of P1227R2 - change span over to use 'size_t' instead of 'ptrdiff_t'. Reviewed as https://reviews.llvm.org/D58639.
llvm-svn: 354936
2019-02-27 00:32:16 +00:00
Louis Dionne 27f79151ec [libc++] Add <filesystem> to the min-mac macro header test
llvm-svn: 354932
2019-02-26 23:14:58 +00:00
Marshall Clow c0170de222 Remove P1272R1, it was not moved in Kona
llvm-svn: 354904
2019-02-26 18:17:30 +00:00
Marshall Clow a04143ee27 Put a 'first implemented' version into the entry for P1357
llvm-svn: 354901
2019-02-26 17:22:47 +00:00
Marshall Clow 7b4ab3b9e4 Mark several issues (and one paper) as complete. Reviewed as D58099; but I added LWG3101 and LWG3144 and P1357R1 as well.
llvm-svn: 354898
2019-02-26 17:01:00 +00:00
Marshall Clow 46c719ddcd Implement P1357: Traits for [Un]bounded Arrays; adopted in Kona
llvm-svn: 354891
2019-02-26 16:07:03 +00:00
Louis Dionne 5d79eaa82f [libc++] Rename _NOALIAS macro to _LIBCPP_NOALIAS
Summary:
For consistency, libc++ macros always start with _LIBCPP. This should
have no functionality change.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 354848
2019-02-26 06:34:42 +00:00
Marshall Clow 310b75e519 LWG3101 - span's Container constructors need another constraint. Reviewed as https://reviews.llvm.org/D57058.
llvm-svn: 354805
2019-02-25 18:32:57 +00:00
Marshall Clow 4fd0395477 Commit LWG3144 - span does not have a const_pointer typedef. Reviewed as D57039.
llvm-svn: 354802
2019-02-25 17:58:03 +00:00
Marshall Clow 9ab85a69dc First part of P1024: Usability Enhancements for std::span. Remove operator() for indexing, and add 'front' and 'back' calls.
llvm-svn: 354801
2019-02-25 17:54:08 +00:00
Marshall Clow 8a7f4c9891 Update status page with papers/issues adopted in Kona
llvm-svn: 354796
2019-02-25 16:12:00 +00:00
Louis Dionne 73be0cb773 [libcxx] Make sure all experimental tests are disabled when enable_experimental=False
Summary:
Previously, we'd run some experimental tests even when enable_experimental=False
was used with lit.

Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, mclow.lists

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

llvm-svn: 354725
2019-02-23 11:24:03 +00:00
Louis Dionne 431cfbf172 [NFC] Fix incorrect comment in std::function test
llvm-svn: 354537
2019-02-21 00:53:26 +00:00
Dimitry Andric d95da99b91 Fix the build with gcc when `-Wredundant-decls` is passed
Summary:
gcc warns that `__throw_runtime_error` is declared both in `<__locale>`
and `<stdexcept>`, if `-Wredundant-decls` is passed on the command
line; this is the case with FreeBSD when ${WARNS} == 6.

Since `<__locale>` gets its first declaration via a transitive include
of `<stdexcept>`, and the second declaration is after the first
invocation of `__throw_runtime_error`, delete that second declaration.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>

Reviewers: kristina, MaskRay, EricWF, ldionne, ngie

Reviewed By: EricWF

Subscribers: krytarowski, brooks, emaste, dim, christof, jdoerfert, libcxx-commits

Tags: #libc

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

llvm-svn: 354515
2019-02-20 21:01:31 +00:00
Jonas Hahnfeld 66c60d9d71 [compiler-rt] Build custom libcxx with libcxxabi
This changes add_custom_libcxx to also build libcxxabi and merges
the two into a static and hermetic library.
There are multiple advantages:
1) The resulting libFuzzer doesn't expose C++ internals and looks
   like a plain C library.
2) We don't have to manually link in libstdc++ to provide cxxabi.
3) The sanitizer tests cannot interfere with an installed version
   of libc++.so in LD_LIBRARY_PATH.

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

llvm-svn: 354212
2019-02-17 12:16:20 +00:00
Louis Dionne 95601bdd29 [libcxx] Do not assume the number of elements in a moved-from associative container
Reviewed as https://reviews.llvm.org/D57903.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 353955
2019-02-13 16:43:44 +00:00
Louis Dionne 7232a84e68 [libc++] Avoid UB in the no-exceptions mode in a few places
Summary:
A few places in the library seem to behave unexpectedly when the library
is compiled or used with exceptions disabled. For example, not throwing
an exception when a pointer is NULL can lead us to dereference the pointer
later on, which is UB. This patch fixes such occurences.

It's hard to tell whether there are other places where the no-exceptions
mode misbehaves like this, because the replacement for throwing an
exception does not always seem to be abort()ing, but at least this
patch will improve the situation somewhat.

See http://lists.llvm.org/pipermail/libcxx-dev/2019-January/000172.html

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 353850
2019-02-12 16:06:02 +00:00
Petr Hosek 5300d84116 [CMake] Avoid passing -rtlib=compiler-rt when using compiler-rt
We build libc++ and libc++abi with -nodefaultlibs, so -rtlib=compiler-rt
has no effect and results in an 'argument unused during compilation'
warning which breaks the build when using -Werror. We can therefore drop
-rtlib=compiler-rt without any functional change; note that the actual
compiler-rt linking is handled by HandleCompilerRT.

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

llvm-svn: 353786
2019-02-12 01:35:29 +00:00
Eric Fiselier 9ebc9dbd3c Don't declare fenv.h functions when they're a macro.
libc still provides function declarations, and these declarations
conflict with libc++'s

llvm-svn: 353774
2019-02-12 00:05:14 +00:00
Eric Fiselier 1eb19e5277 Make the sym_diff utilities more useful.
In particular when working with static libraries and libstdc++.

llvm-svn: 353772
2019-02-12 00:00:43 +00:00
Eric Fiselier cf39dd44b8 Add fenv.h header
Summary:
Some implementations of fenv.h use macros to define the functions they provide. This can cause problems when `std::fegetround()` is spelled in source.

This patch adds a `fenv.h` header to libc++ for the sole purpose of turning those macros into real functions.

Reviewers: rsmith, mclow.lists, ldionne

Reviewed By: rsmith

Subscribers: mgorny, christof, libcxx-commits

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

llvm-svn: 353767
2019-02-11 23:47:19 +00:00
Petr Hosek 1405ac457b [libcxx] Preserve order, avoid duplicates when merging static archives
glob can return files in arbitrary order which breaks deterministic
builds. Rather, use `ar t` to list the files in each archive and
preserve the original order. Using `ar q` results in duplicate entries
in the archive, instead use `ar r` to avoid duplicates.

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

llvm-svn: 353671
2019-02-11 08:48:47 +00:00
Chandler Carruth 9d610c5a53 The new file header didn't get carried over when these files were
"moved" somehow, update them to use it.

llvm-svn: 353669
2019-02-11 08:39:23 +00:00
Chandler Carruth a20f61106b Update some newly added files that mistakenly used the old file header
to the new one.

llvm-svn: 353668
2019-02-11 08:39:14 +00:00
Eric Fiselier e8adbae00a fix -Wextra-semi warnings
llvm-svn: 353650
2019-02-10 18:29:00 +00:00
Eric Fiselier 9d487c7d1e Make LIBCXX_STANDARD_VER configurable
llvm-svn: 353649
2019-02-10 18:27:55 +00:00
Eric Fiselier 609d676aab Format sym_extract.py output to minimize diff output.
Different versions of python print dictionaries in different orders.
 This can mess up diffs when updating ABI lists. This patch uses
 pprint.pformat to print the dicts to get a consistent ordering.

llvm-svn: 353634
2019-02-10 04:48:54 +00:00
Eric Fiselier 17f9331339 Add missing symbols to Apple v2 abi list.
The itoa symbols were added and their addition is documented in the CHANGELOG.
I'm not sure why the valarray symbols were missing previously, but they're
present in the v1 ABI lists and should be here as well.

llvm-svn: 353633
2019-02-10 04:41:48 +00:00
Eric Fiselier 7cddb68292 Add ABI list directories for 8.0
llvm-svn: 353632
2019-02-10 04:09:46 +00:00
Kamil Rytarowski 61113341f7 Mark another test as flaky
Reported on the NetBSD buildbot.

llvm-svn: 353622
2019-02-09 18:39:07 +00:00
Petr Hosek b34fed1a2e [libcxx] Support runtimes and monorepo locations for tests
The test configuration support currently searches for libc++ sources
in <ROOT>/projects/libcxx. This change also additionally searches
<ROOT>/runtimes/libcxx (so called runtimes layout) and <ROOT>/libcxx
(monorepo layout).

This matches the logic we already use in CMake, for example:
https://github.com/llvm/llvm-project/blob/6fd4e7f/libcxx/CMakeLists.txt#L148

When the monorepo becomes the only supported layout in the future,
we can simplify this logic again.

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

llvm-svn: 353600
2019-02-09 02:50:09 +00:00
Marshall Clow aa09911aef Add static_asserts to tuple's comparison operators to enforce the requirement that the tuples be the same size. See PR39183 for an example where we give unexpected results for this bad input case. With this change, we will reject it at compile-time
llvm-svn: 353450
2019-02-07 19:03:48 +00:00
Marshall Clow 954966c1af Add UBSAN annotation to __hash_table::rehash; we don't do anything wrong, but UBSAN's checker flags it as suspicious. See PR38606. NFC
llvm-svn: 353448
2019-02-07 18:53:58 +00:00
Louis Dionne feeedafd28 Revert "[libc++] Only add dylib-related features when using the system's libc++"
This reverts r353319, which broke our internal CI.

llvm-svn: 353321
2019-02-06 18:33:02 +00:00
Louis Dionne 6f6beae627 [libc++] Only add dylib-related features when using the system's libc++
Otherwise, when testing trunk libc++ on an older system, lit will think
that the dylib features are disabled. Ideally, we'd have a notion of
running the tests with/without a deployment target (or, equivalently,
a deployment target representing trunk where everything is as recent
as can be). Since we always have a deployment target right now (which
defaults to the current system), we only enable those features when
we're going to also be testing with the system libc++.

llvm-svn: 353319
2019-02-06 18:06:50 +00:00
Marshall Clow c8879ab2fd Add a specialization for '__unwrap_iter' to handle const interators. This enables the 'memmove' optimization for std::copy, etc.
llvm-svn: 353311
2019-02-06 16:10:25 +00:00
Louis Dionne a53eb79be6 [libc++] Fix XFAILs when exceptions are disabled
It turns out that I un-XFAILed too many tests in r353210: some tests
actually fail whether exceptions are enabled or not because they use
types that are marked as unavailable even when exceptions are disabled.

llvm-svn: 353215
2019-02-05 20:55:23 +00:00
Louis Dionne f5f2f77755 [libc++] Fix XFAILs on macOS when exceptions are disabled
Some tests are marked as failing on platforms where the dylib does not
provide the required exception classes. However, when testing with
exceptions disabled, those tests shouldn't be marked as failing.

llvm-svn: 353210
2019-02-05 20:11:58 +00:00
Petr Hosek 97bc08ae02 [CMake] Support compiler-rt builtins library in tests
We're building tests with -nostdlib which means that we need to
explicitly include the builtins library. When using libgcc (default)
we can simply include -lgcc_s on the link line, but when using
compiler-rt builtins we need a complete path to the builtins library.

This path is already available in CMake as <PROJECT>_BUILTINS_LIBRARY,
so we just need to pass that path to lit and if config.compiler_rt is
true, link it to the test.

Prior to this patch, running tests when compiler-rt is being used as
the builtins library was broken as all tests would fail to link, but
with this change running tests when compiler-rt bultins library is
being used should be supported.

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

llvm-svn: 353208
2019-02-05 19:50:47 +00:00
Louis Dionne bb6d61c752 [libc++] Use UNSUPPORTED instead of TEST_STD_VER #ifdef
When the whole test only works starting at some version of the Standard,
use UNSUPPORTED lit markup instead of #ifdef TEST_STD_VER. This provides
more visibility into the test suite.

Reviewed as https://reviews.llvm.org/D57704.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 353206
2019-02-05 19:50:17 +00:00
Louis Dionne 51358e45e2 [libcxx] Start defining lit features for tests depending on availability
This patch removes some vendor-specific availability XFAILs from the
test suite. In the future, when a new feature is introduced in the
dylib, an availability macro should be created and a matching lit
feature should be created. That way, the test suite can XFAIL whenever
the implementation lacks the necessary feature instead of being
cluttered by vendor-specific annotations.

Right now, those vendor-specific annotations are still somewhat cluttering
the test suite by being in `config.py`, but at least they are localized.
In the future, we could design a way to define those less intrusively or
even automatically based on the availability macros that already exist
in <__config>.

llvm-svn: 353201
2019-02-05 19:22:38 +00:00
Louis Dionne a3ec627a1c [libc++] Control whether exceptions are enabled in the macOS trunk testing script
llvm-svn: 353185
2019-02-05 16:42:37 +00:00
Louis Dionne b3b8968117 [NFC][libc++] Reindent function
llvm-svn: 353180
2019-02-05 15:46:52 +00:00
JF Bastien 73f499771f Fix double curlies
Pointed out by Arthur in D57624.

llvm-svn: 353140
2019-02-05 05:34:12 +00:00
Petr Hosek 3ad50fed48 [CMake] Update lit test configuration
There are several changes:
- Don't stringify Pythonized bools (that's why we're Pythonizing them)
- Support specifying target and sysroot via CMake variables
- Use consistent spelling for --target, --sysroot, --gcc-toolchain

llvm-svn: 353137
2019-02-05 04:44:03 +00:00
JF Bastien 2df59c5068 Support tests in freestanding
Summary:
Freestanding is *weird*. The standard allows it to differ in a bunch of odd
manners from regular C++, and the committee would like to improve that
situation. I'd like to make libc++ behave better with what freestanding should
be, so that it can be a tool we use in improving the standard. To do that we
need to try stuff out, both with "freestanding the language mode" and
"freestanding the library subset".

Let's start with the super basic: run the libc++ tests in freestanding, using
clang as the compiler, and see what works. The easiest hack to do this:

In utils/libcxx/test/config.py add:

  self.cxx.compile_flags += ['-ffreestanding']

Run the tests and they all fail.

Why? Because in freestanding `main` isn't special. This "not special" property
has two effects: main doesn't get mangled, and main isn't allowed to omit its
`return` statement. The first means main gets mangled and the linker can't
create a valid executable for us to test. The second means we spew out warnings
(ew) and the compiler doesn't insert the `return` we omitted, and main just
falls of the end and does whatever undefined behavior (if you're luck, ud2
leading to non-zero return code).

Let's start my work with the basics. This patch changes all libc++ tests to
declare `main` as `int main(int, char**` so it mangles consistently (enabling us
to declare another `extern "C"` main for freestanding which calls the mangled
one), and adds `return 0;` to all places where it was missing. This touches 6124
files, and I apologize.

The former was done with The Magic Of Sed.

The later was done with a (not quite correct but decent) clang tool:

  https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed

This works for most tests, though I did have to adjust a few places when e.g.
the test runs with `-x c`, macros are used for main (such as for the filesystem
tests), etc.

Once this is in we can create a freestanding bot which will prevent further
regressions. After that, we can start the real work of supporting C++
freestanding fairly well in libc++.

<rdar://problem/47754795>

Reviewers: ldionne, mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits

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

llvm-svn: 353086
2019-02-04 20:31:13 +00:00
Petr Hosek 6fd4e7fe02 [CMake] Support CMake variables for setting target, sysroot and toolchain
CMake has a standard way of setting target triple, sysroot and external
toolchain through CMAKE_<LANG>_COMPILER_TARGET, CMAKE_SYSROOT and
CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN. These are turned into
corresponding --target=, --sysroot= and --gcc-toolchain= variables add
included appended to CMAKE_<LANG>_FLAGS.

libunwind, libc++abi, libc++ provides their own mechanism through
<PROJECT>_TARGET_TRIPLE, <PROJECT>_SYSROOT and <PROJECT>_GCC_TOOLCHAIN
variables. These are also passed to lit via lit.site.cfg, and lit config
uses these to set the corresponding compiler flags when building tessts.

This means that there are two different ways of setting target, sysroot
and toolchain, but only one is properly supported in lit. This change
extends CMake build for libunwind, libc++abi and libc++ to also support
the CMake variables in addition to project specific ones in lit.

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

llvm-svn: 353084
2019-02-04 20:02:26 +00:00
Eric Fiselier 508da4156a Move the feature test macros script to the utils directory.
It doesn't make a lot of sense to keep it with the tests,
deep into the test suite directonies.

llvm-svn: 352970
2019-02-02 23:13:49 +00:00
Eric Fiselier 1bccafe4f6 Handle cases where the dirent::d_type macros aren't defined
llvm-svn: 352942
2019-02-01 23:52:17 +00:00
Marshall Clow 2e719bc428 add a test and a couple minor bug fixes for the implicit-signed-integer-truncation sanitizer. This is PR#40566
llvm-svn: 352926
2019-02-01 21:59:27 +00:00
Louis Dionne 6b653fc70f [libc++] Disentangle the 3 implementations of type_info
Summary:
We currently have effectively 3 implementations of type_info: one for
the Microsoft ABI, one that does not assume that there's a unique copy
of each RTTI in a progran, and one that assumes a unique copy.

Those 3 implementations are entangled into the same class with nested
ifdefs, which makes it very difficult to understand. Furthermore, the
benefit of doing this is rather small since the code that is duplicated
across implementations is just a couple of trivial lines.

This patch stamps out the 3 versions of type_info explicitly to increase
readability. It also explains what's going on with short comments, because
it's far from obvious.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith

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

llvm-svn: 352905
2019-02-01 20:00:13 +00:00
Marshall Clow dd426c2fbd Fix a bit of libc++-specific behavior in the regex tests; add a missing test. Reviewed as https://reviews.llvm.org/D57391 Thanks to Andrey Maksimov for the patch
llvm-svn: 352781
2019-01-31 18:54:26 +00:00
Petr Hosek 8e78915446 [CMake] Use correct visibility for linked libraries in CMake
When linking library dependencies, we shouldn't need to export linked
libraries to dependents. We should be explicit about this in
target_link_libraries, otherwise other targets that depend on these such
as sanitizers get repeated (and possibly even conflicting) dependencies.

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

llvm-svn: 352688
2019-01-30 23:18:05 +00:00
Petr Hosek c0b3d36990 Revert "[CMake] Use correct visibility for linked libraries in CMake"
This reverts commit r352654: this broke libcxx and sanitizer bots.

llvm-svn: 352658
2019-01-30 19:51:18 +00:00
Petr Hosek b9128d8def [CMake] Use correct visibility for linked libraries in CMake
When linking library dependencies, we shouldn't need to export linked
libraries to dependents. We should be explicit about this in
target_link_libraries, otherwise other targets that depend on these such
as sanitizers get repeated (and possibly even conflicting) dependencies.

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

llvm-svn: 352654
2019-01-30 19:27:26 +00:00
Thomas Anderson 3663f26fb3 [libc++] Explicitly initialize std::nothrow
When building on Windows without libc++abi, this change fixes a build error of the form:

    src/new.cpp(38,17):  error: chosen constructor is explicit in copy-initialization
    const nothrow_t nothrow = {};
    include/vcruntime_new.h(53,22):  note: explicit constructor declared here
                explicit nothrow_t() = default;

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

llvm-svn: 352648
2019-01-30 19:09:41 +00:00
Thomas Anderson 13447450bc [libc++] Don't define operator new/delete when using vcruntime
Fixes build errors on Windows without libc++abi of the form:

    new(173,36):  error: redeclaration of 'operator delete' cannot add 'dllexport' attribute
    _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p) _NOEXCEPT;
    vcruntime_new.h(87,16):  note: previous declaration is here
    void __CRTDECL operator delete(
    new(205,70):  error: redefinition of 'operator new'
    _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new  (std::size_t, void* __p) _NOEXCEPT {return __p;}
    vcruntime_new.h(184,28):  note: previous definition is here
        inline void* __CRTDECL operator new(size_t _Size, _Writable_bytes_(_Size) void* _Where) noexcept
    new(206,70):  error: redefinition of 'operator new[]'
    _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
    vcruntime_new.h(199,28):  note: previous definition is here
        inline void* __CRTDECL operator new[](size_t _Size,
    new(207,40):  error: redefinition of 'operator delete'
    inline _LIBCPP_INLINE_VISIBILITY void  operator delete  (void*, void*) _NOEXCEPT {}
    vcruntime_new.h(190,27):  note: previous definition is here
        inline void __CRTDECL operator delete(void*, void*) noexcept
    new(208,40):  error: redefinition of 'operator delete[]'
    inline _LIBCPP_INLINE_VISIBILITY void  operator delete[](void*, void*) _NOEXCEPT {}
    vcruntime_new.h(206,27):  note: previous definition is here
        inline void __CRTDECL operator delete[](void*, void*) noexcept

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

llvm-svn: 352647
2019-01-30 19:08:32 +00:00
Thomas Anderson 095ed0554f [libc++] Don't define exception destructors when using vcruntime
Exception destructors are provided by vcruntime.  Fixes link errors like:

    lld-link: error: duplicate symbol: "public: virtual __cdecl std::invalid_argument::~invalid_argument(void)" (??1invalid_argument@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
    lld-link: error: duplicate symbol: "public: virtual __cdecl std::length_error::~length_error(void)" (??1length_error@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
    lld-link: error: duplicate symbol: "public: virtual __cdecl std::out_of_range::~out_of_range(void)" (??1out_of_range@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
    lld-link: error: duplicate symbol: "public: virtual __cdecl std::overflow_error::~overflow_error(void)" (??1overflow_error@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)

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

llvm-svn: 352646
2019-01-30 19:07:30 +00:00
Thomas Anderson 7f50dfa6fc [libc++] Fix Windows build error in <functional>
On my Windows system, __allocator is defined to nothing.  This change fixes build errors of the below form:

    In file included from algorithm:644:
    functional(1492,31):  error: expected member name or ';' after declaration specifiers
        const _Alloc& __allocator() const { return __f_.second(); }

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

llvm-svn: 352561
2019-01-29 23:19:45 +00:00
Thomas Anderson db9152c248 [libc++] Fix Windows build error in include/filesystem
_LIBCPP_FUNC_VIS is redundant since the class is already annotated with
_LIBCPP_EXCEPTION_ABI.

Fixes this build error:

    In file included from fstream:188:
    filesystem(1350,3):  error: attribute 'dllimport' cannot be applied to member of 'dllimport' class
      _LIBCPP_FUNC_VIS
    __config(674,37):  note: expanded from macro '_LIBCPP_FUNC_VIS'
    #define _LIBCPP_FUNC_VIS            _LIBCPP_DLL_VIS
    __config(666,38):  note: expanded from macro '_LIBCPP_DLL_VIS'
    #  define _LIBCPP_DLL_VIS __declspec(dllimport)
    filesystem(1313,7):  note: previous attribute is here
    class _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error {
    __config(675,37):  note: expanded from macro '_LIBCPP_EXCEPTION_ABI'
    #define _LIBCPP_EXCEPTION_ABI       _LIBCPP_DLL_VIS
    __config(666,38):  note: expanded from macro '_LIBCPP_DLL_VIS'
    #  define _LIBCPP_DLL_VIS __declspec(dllimport)

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

llvm-svn: 352525
2019-01-29 18:48:35 +00:00
Eric Fiselier 011943a6e8 Fix PR40495 - is_invokable_v<void> does not compile
The meta-programming that attempted to form the invoke call expression
was not in a SFINAE context. This made it a hard error to provide
non-referencable types like 'void' or 'void (...) const'.

This patch fixes the error by checking the validity of the call
expression within a SFINAE context.

llvm-svn: 352522
2019-01-29 18:01:14 +00:00
James Y Knight 5d71fc5d7b Adjust documentation for git migration.
This fixes most references to the paths:
 llvm.org/svn/
 llvm.org/git/
 llvm.org/viewvc/
 github.com/llvm-mirror/
 github.com/llvm-project/
 reviews.llvm.org/diffusion/

to instead point to https://github.com/llvm/llvm-project.

This is *not* a trivial substitution, because additionally, all the
checkout instructions had to be migrated to instruct users on how to
use the monorepo layout, setting LLVM_ENABLE_PROJECTS instead of
checking out various projects into various subdirectories.

I've attempted to not change any scripts here, only documentation. The
scripts will have to be addressed separately.

Additionally, I've deleted one document which appeared to be outdated
and unneeded:
  lldb/docs/building-with-debug-llvm.txt

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

llvm-svn: 352514
2019-01-29 16:37:27 +00:00
Louis Dionne 6409d75698 [NFC] Add missing revision for removal of bad_array_length in ABI changelog
llvm-svn: 352513
2019-01-29 16:30:11 +00:00
Marshall Clow c02236b6f5 Mark some of the behavior in the move w/allocator constructors of deque/unordered containers as 'libc++-specific'. Thanks to Andrey Maksimov for pointing this out.
llvm-svn: 352512
2019-01-29 16:12:45 +00:00
Petr Hosek 4155e78912 [libc++] Use runtime rather then compile-time glibc version check
glibc supports versioning, so it's possible to build against older
version and run against newer version. This is sometimes relied on
in practice, e.g. in Fuchsia build we build against older sysroot
(equivalent to Ubuntu Trusty) to cover the broadest possible range
of host systems, but that doesn't necessarily match the system that
binary is going to run on which may have newer version, in which case
the compile test used in curr_symbol is going to fail. Using runtime
check is more reliable.

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

llvm-svn: 352425
2019-01-28 20:39:50 +00:00
Petr Hosek 12f4b86808 Revert "[CMake] Use __libc_start_main rather than fopen when checking for C library"
This reverts commit r352341: it broke the build on macOS which doesn't
seem to provide __libc_start_main in its C library.

llvm-svn: 352411
2019-01-28 19:26:41 +00:00
Michal Gorny d4b194cf95 [cmake] Fix get_llvm_lit_path() to respect LLVM_EXTERNAL_LIT always
Refactor the get_llvm_lit_path() logic to respect LLVM_EXTERNAL_LIT,
and require the fallback to be defined explicitly
as LLVM_DEFAULT_EXTERNAL_LIT. This fixes building libcxx standalone
after r346888.

The old logic was using LLVM_EXTERNAL_LIT both as user-defined cache
variable and an optional pre-definition of default value from caller
(e.g. libcxx). It included a hack to make this work by assigning
the value back and forth but it was fragile and stopped working
in libcxx.

The new logic is simpler and more transparent. Default value is
provided in a separate variable, and used only when user-specified
variable is empty (i.e. not overriden).

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

llvm-svn: 352374
2019-01-28 15:16:03 +00:00
Petr Hosek b667153cf6 [CMake] Use __libc_start_main rather than fopen when checking for C library
The check_library_exists CMake uses a custom symbol definition. This
is a problem when checking for C library symbols because Clang
recognizes many of them as builtins, and returns the
-Wbuiltin-requires-header (or -Wincompatible-library-redeclaration)
error. When building with -Werror which is the default, this causes
the check_library_exists check fail making the build think that C
library isn't available.

To avoid this issue, we should use a symbol that isn't recognized by
Clang and wouldn't cause the same issue. __libc_start_main seems like
reasonable choice that fits the bill.

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

llvm-svn: 352341
2019-01-28 04:12:54 +00:00
Eric Fiselier d258c80414 update upcoming meeting issue status
llvm-svn: 352339
2019-01-28 02:59:01 +00:00
Kamil Rytarowski 7c56f115b4 Mark awk.pass.cpp as XFAIL for NetBSD
Reported on the NetBSD 8 build bot.

llvm-svn: 352097
2019-01-24 20:26:02 +00:00
Marshall Clow 5a8525e0b6 D14686: 'Protect against overloaded comma in random_shuffle and improve tests' I had to cut back on the tests with this, because they were not C++03 friendly. Thanks to gribozavr for the patch
llvm-svn: 352087
2019-01-24 19:20:19 +00:00
Louis Dionne c43f673090 [libcxx] Portability fix: unordered_set and unordered_multiset iterators are not required to be the same
The unordered_set and unordered_multiset iterators are specified in the standard as follows:

using iterator             = implementation-defined; // see [container.requirements]
using const_iterator       = implementation-defined; // see [container.requirements]
using local_iterator       = implementation-defined; // see [container.requirements]
using const_local_iterator = implementation-defined; // see [container.requirements]

The pairs iterator/const_iterator and local_iterator/const_local_iterator
are not required to be the same. The reasonable requirement would be that
iterator can convert to const_iterator and local_iterator can convert to
const_local_iterator. This patch weakens the check and makes the test
more portable.

Reviewed as https://reviews.llvm.org/D56493.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 352083
2019-01-24 19:09:22 +00:00
Kamil Rytarowski 47c0eb2bc2 Mark another test as flaky
Reported on the NetBSD 8 buildbot.

llvm-svn: 352064
2019-01-24 17:17:55 +00:00
Marshall Clow 6973bb06d9 Change a couple of '&' to addressof(). NFC
llvm-svn: 352007
2019-01-24 02:02:50 +00:00
Marshall Clow f6b6be2f7a Uncomment the entire test, but mark as XFAIL on linux-gnu because it uses locales that aren't generally available there, similar to the other regex tests
llvm-svn: 352006
2019-01-24 01:52:56 +00:00
Kamil Rytarowski d3068a2c2f Mark another test as flaky
Reported on the NetBSD 8 buildbot.

llvm-svn: 351995
2019-01-23 23:24:43 +00:00
Marshall Clow 28166dd9b3 Apply D28248: 'Work around GCC PR37804'. Thanks to mdaniels for the patch
llvm-svn: 351993
2019-01-23 23:06:18 +00:00
Casey Carter 1ecf6e55cd [test] Define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST in msvc_stdlib_force_include.hpp
...so the tests under test/std/utilities/any continue to
compile with MSVC's standard library.

While we're here, let's test >C++17 features when _HAS_CXX20.

llvm-svn: 351991
2019-01-23 22:49:44 +00:00
Kamil Rytarowski 829d916d7d Mark another test as flaky
Reported on the NetBSD 8 buildbot.

llvm-svn: 351988
2019-01-23 22:35:57 +00:00
Kamil Rytarowski 314bd26db1 Correct mark for flaky tests
Add missing trailing dot.

llvm-svn: 351983
2019-01-23 21:45:02 +00:00
Marshall Clow 8681a3bc85 Commit D11348: 'Win32 support: wcsnrtombs and mbsnrtowcs don't handle null output buffers correctly' which has been hanging around for a long time
llvm-svn: 351971
2019-01-23 18:27:22 +00:00
Kamil Rytarowski 776cf71d4f Mark more tests flaky
Reported on the NetBSD 8 buildbot

llvm-svn: 351944
2019-01-23 11:36:19 +00:00
Kamil Rytarowski fe1991b55e Mark thread.condition.condvarany/wait_for.pass.cpp as flaky
Reported on the NetBSD 8 buildbot.

llvm-svn: 351937
2019-01-23 10:11:41 +00:00
Marshall Clow 8f302e6222 While reviewing D57058, Louis had some questions about the existing span constructor tests. They were not testing the stuff that they said they were. Updated the tests to test what they should have been doing
llvm-svn: 351887
2019-01-22 22:01:13 +00:00
Louis Dionne 53e8ece06a [libcxx] Include <cstring> in tests that use strcmp
Reviewed as https://reviews.llvm.org/D56503.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 351847
2019-01-22 17:45:00 +00:00
Marshall Clow 03ed93fd37 Note that we have a patch for LWG3101
llvm-svn: 351832
2019-01-22 16:22:53 +00:00
Marshall Clow 9846f5f792 Updated issue 3144
llvm-svn: 351773
2019-01-22 01:05:58 +00:00
Marshall Clow c09219363c Update with issues to be moved in San Diego
llvm-svn: 351770
2019-01-22 00:31:09 +00:00
Chandler Carruth 4a1b95bda0 Fix typos throughout the license files that somehow I and my reviewers
all missed!

Thanks to Alex Bradbury for pointing this out, and the fact that I never
added the intended `legacy` anchor to the developer policy. Add that
anchor too. With hope, this will cause the links to all resolve
successfully.

llvm-svn: 351731
2019-01-21 09:52:34 +00:00
Eric Fiselier 85bdbbf9a1 Fix aligned allocation availability XFAILs after D56445.
D56445 bumped the minimum Mac OS X version required for aligned
allocation from 10.13 to 10.14. This caused libc++ tests depending
on the old value to break.

This patch updates the XFAILs for those tests to include 10.13.

llvm-svn: 351670
2019-01-20 01:21:35 +00:00
Eric Fiselier 3662572275 Revert "Fix aligned allocation availability XFAILs after D56445."
This reverts commit r351625.

That fix was incomplete. I'm reverting so I can commit a complete fix
in a single revision.

llvm-svn: 351669
2019-01-20 01:12:53 +00:00
Eric Fiselier b0f1013a73 Improve docker images and configuration; create compiler-zoo image
llvm-svn: 351667
2019-01-19 23:36:06 +00:00
Chandler Carruth bd9dafecf7 Update an example to use the new LLVM file header.
llvm-svn: 351653
2019-01-19 11:54:04 +00:00
Chandler Carruth b3ee4190e7 Update generator script to use the new license file header.
llvm-svn: 351650
2019-01-19 11:38:40 +00:00
Chandler Carruth 57b08b0944 Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351648
2019-01-19 10:56:40 +00:00
Eric Fiselier 8c0332204d Fix all the bots.
The buildbot start scripts hardcode the version string.
Bump it from 8 to 9.

llvm-svn: 351638
2019-01-19 09:07:04 +00:00
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Chandler Carruth 469bdefd44 Install new LLVM license structure and new developer policy.
This installs the new developer policy and moves all of the license
files across all LLVM projects in the monorepo to the new license
structure. The remaining projects will be moved independently.

Note that I've left odd formatting and other idiosyncracies of the
legacy license structure text alone to make the diff easier to read.
Critically, note that we do not in any case *remove* the old license
notice or terms, as that remains necessary until we finish the
relicensing process.

I've updated a few license files that refer to the LLVM license to
instead simply refer generically to whatever license the LLVM project is
under, basically trying to minimize confusion.

This is really the culmination of so many people. Chris led the
community discussions, drafted the policy update and organized the
multi-year string of meeting between lawyers across the community to
figure out the strategy. Numerous lawyers at companies in the community
spent their time figuring out initial answers, and then the Foundation's
lawyer Heather Meeker has done *so* much to help refine and get us ready
here. I could keep going on, but I just want to make sure everyone
realizes what a huge community effort this has been from the begining.

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

llvm-svn: 351631
2019-01-19 06:14:24 +00:00
Eric Fiselier a32dd04238 Fix aligned allocation availability XFAILs after D56445.
D56445 bumped the minimum Mac OS X version required for aligned
allocation from 10.13 to 10.14. This caused libc++ tests depending
on the old value to break.

This patch updates the XFAILs for those tests to include 10.13.

llvm-svn: 351625
2019-01-19 03:27:05 +00:00
Eric Fiselier 0e997efd53 [hurd] Fix unconditional use of PATH_MAX
Patch by Samuel Thibault

The GNU/Hurd system does not define an arbitrary PATH_MAX limitation, the POSIX 2001 realpath
extension can be used instead, and the size of symlinks can be determined.

Reviewed as https://reviews.llvm.org/D54677

llvm-svn: 351414
2019-01-17 02:59:28 +00:00
Hans Wennborg 1fe469ae6c Bump the trunk version to 9.0.0svn
llvm-svn: 351320
2019-01-16 10:57:02 +00:00
Eric Fiselier 973eab8a5d correct script name in generated tests
llvm-svn: 351299
2019-01-16 05:43:02 +00:00
Eric Fiselier efdac65f70 Attempt to make test_macros.h even more minimal
llvm-svn: 351292
2019-01-16 02:16:57 +00:00
Eric Fiselier 05019eb79f Fix feature test macros for atomics/mutexes without threading
llvm-svn: 351291
2019-01-16 02:10:28 +00:00
Eric Fiselier d01a4aa068 Fix PR40230 - std::pair may have padding on FreeBSD.
Summary:
FreeBSD ships a very old and deprecated ABI for std::pair where the copy and move constructors are not allowed to be trivial. D25389 change how this was implemented by introducing a non-trivial base class. This patch, introduced in October 2016, introduced an ABI bug that caused nested `std::pair` instantiations to have padding. For example:

```
using PairT = std::pair< std::pair<char, char>, char >;
static_assert(offsetof(PairT, first) == 0, "First member should exist at offset zero"); // Fails on FreeBSD!
```

The bug occurs because the base class for the first element (the nested pair) cannot be put at offset zero because the top-level pair already has the same base class laid out there.

This patch fixes that ABI bug by templating the dummy base class on the same parameters as the pair.

Technically this fix is an ABI break for users who depend on the "broken" ABI introduced in 2016. I'm putting this up for review so that the FreeBSD maintainers can sign off on fixing the ABI by breaking the ABI.
Another option, since we have to "break" the ABI to fix it, would be to move FreeBSD off the deprecated non-trivial pair ABI instead.

Also see:

* https://llvm.org/PR40230
* https://reviews.llvm.org/D21329



Reviewers: rsmith, dim, emaste

Reviewed By: rsmith

Subscribers: mclow.lists, krytarowski, christof, ldionne, libcxx-commits

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

llvm-svn: 351290
2019-01-16 01:54:34 +00:00
Eric Fiselier d108bf85b0 Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`.
Summary:
Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See  llvm.org/PR39713

This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used.

This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement.

I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. 

Reviewers: ldionne, EricWF

Reviewed By: ldionne, EricWF

Subscribers: jyknight, christof, libcxx-commits

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

llvm-svn: 351289
2019-01-16 01:51:12 +00:00
Eric Fiselier 32784a740a Implement feature test macros using a script.
Summary:
This patch implements all the feature test macros libc++ currently supports, as specified by the standard or cppreference prior to C++2a.

The tests and `<version>` header are generated using a script. The script contains a table of each feature test macro, the headers it should be accessible from, and its values of each dialect of C++.
When a new feature test macro is added or needed, the table should be updated and the script re-run.



Reviewers: mclow.lists, jfb, serge-sans-paille

Reviewed By: mclow.lists

Subscribers: arphaman, jfb, ldionne, libcxx-commits

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

llvm-svn: 351286
2019-01-16 01:37:43 +00:00
Dan Albert 45b511fb05 Fix size_t/off_t mixup in std::filesystem.
Summary: ftruncate takes an off_t, not a size_t.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: christof, ldionne, libcxx-commits

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

llvm-svn: 351226
2019-01-15 19:16:25 +00:00
Dan Albert 5452d3f099 Add large file support to create_file for 32-bit.
Summary:
The tests need to create files larger than 2GB, but size_t is 32-bit
on a 32-bit system. Make use of explicit off64_t APIs so we can still
use a default off_t for the tests while enabling 64-bit file offsets
for create_file.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: christof, ldionne, libcxx-commits

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

llvm-svn: 351225
2019-01-15 19:14:15 +00:00
Petr Hosek 20c425cdab [libc++] Support different libc++ namespaces in the iterator test
libc++ allows changing the namespace, don't assume __1 in the test
to avoid the test failure if different namespace is being used.

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

llvm-svn: 351220
2019-01-15 18:55:55 +00:00
Hans Wennborg eb60fbfdb4 Update year in license files
In last year's update (D48219) it was suggested that the release manager
might want to do this, so here we go.

llvm-svn: 351194
2019-01-15 15:10:32 +00:00
Casey Carter dcaaa1baed [test] Fix logic error in <compare> tests; enable for MSVC Dev16
Submitted upstream as https://reviews.llvm.org/D53763.

llvm-svn: 351148
2019-01-15 01:53:12 +00:00
Marshall Clow f3126c8bc5 Generalize the comparison test structure to support cross-type comparisons. NFC to the library
llvm-svn: 351140
2019-01-15 00:05:05 +00:00
Petr Hosek 2fefe153dd [libcxx] Mark do_open, do_get and do_close parameters unused when catopen is missing
When catopen is missing, do_open, do_get and do_close end up being
no-op, and as such their parameters will be unused which triggers a
warning/error when building with -Wunused-parameter.

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

llvm-svn: 351027
2019-01-13 22:15:37 +00:00
Marshall Clow e495760140 Change from a to a . Fixes PR#39871.
llvm-svn: 350972
2019-01-11 21:57:12 +00:00
Adhemerval Zanella 63ea958521 [libcxx] Call __count_bool_true for bitset count
This patch aims to help clang with better information so it can inline
__bit_reference count function usage for both std::biset. Current clang
inliner can not infer that the passed typed will be used only to select
the optimized variant, it evaluates the type argument and type check as
a load plus compare (although later optimization phases correctly
optimized this out).

It is mainly to help llvm inliner to generate better code for std::bitset
count for aarch64. It helps on both runtime and code size, since if inline
decides that _VSTD::count should not be inlined the vectorization will
create both aligned and unaligned variants (which add both code size and
runtime costs)

llvm-svn: 350936
2019-01-11 17:31:17 +00:00
Marshall Clow 80378fd38b Don't use the form '2017y' in tests, since some gcc versions don't allow it
llvm-svn: 350930
2019-01-11 15:45:56 +00:00
Marshall Clow 5c08881343 Implement the 'sys_time' portions of the C++20 calendaring stuff. Reviewed as D56494
llvm-svn: 350929
2019-01-11 15:12:04 +00:00
Louis Dionne 1d5f6a81f5 [libcxx] Reorganize tests since the application of P0602R4
Summary:
P0602R4 makes the special member functions of optional and variant
conditionally trivial based on the types in the optional/variant.
We already implemented that, but the tests were organized as if this
were a non-standard extension. This patch reorganizes the tests in a
way that makes more sense since this is not an extension anymore.

Reviewers: EricWF, mpark, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 350884
2019-01-10 20:06:11 +00:00
JF Bastien a936f84863 Filesystem tests: fix fs.op.relative
Summary: The test wasn't using the testing infrastructure properly.

Reviewers: ldionne, mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 350872
2019-01-10 18:50:34 +00:00
JF Bastien 1026ce6de4 [NFC] Always lock free test: add indirection
I have a big patch coming up, and this indirection is required to avoid hitting the following after my big change:

  error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat]

llvm-svn: 350772
2019-01-09 23:20:24 +00:00
JF Bastien 2f4df4c986 [NFC] Normalize some test 'main' signatures
There were 3 tests with 'int main(void)', and 6 with the return type on a different line. I'm about to send a patch for main in tests, and this NFC change is unrelated.

llvm-svn: 350770
2019-01-09 22:56:45 +00:00
Louis Dionne 227371ded6 [libcxx] Add a script to run CI on older MacOS versions
This script can be used by CI systems to test things like availability
markup and binary compatibility on older MacOS versions. This is still
a bit rough on the edges, for example we don't test libc++abi yet.

llvm-svn: 350752
2019-01-09 19:40:20 +00:00
Louis Dionne cb4e59ed92 [libcxx] Add a script to run CI on MacOS
CI systems like Green Dragon should use this script so as to make
reproducing errors easy locally.

llvm-svn: 350740
2019-01-09 16:35:55 +00:00