Commit Graph

191 Commits

Author SHA1 Message Date
zoecarver 0f4b41e038 [libcxx][ranges] Add ranges::take_view.
Differential Revision: https://reviews.llvm.org/D106507
2021-07-28 12:14:21 -07:00
zoecarver 8a48e6dda9 [libcxx][ranges] Add `counted_iterator`.
Differential Revision: https://reviews.llvm.org/D106205
2021-07-27 15:50:11 -07:00
zoecarver e5d8b93e5a [libcxx][ranges] Add `ranges::common_view`.
Differential Revision: https://reviews.llvm.org/D105753
2021-07-23 09:08:49 -07:00
Christopher Di Bella 0cf65382ad [libcxx][modularisation] properly modularises advance, next, and prev
`__function_like` wasn't being exported, so certain properties of the
`ranges` functions weren't being propagated in modules land.

Differential Revision: https://reviews.llvm.org/D105078
2021-07-22 23:30:02 +00:00
Louis Dionne 3959c95deb [libc++] Add helper type non-propagating-cache
Differential Revision: https://reviews.llvm.org/D102121
2021-07-22 14:30:16 -04:00
Christopher Di Bella 74fd3cb8cd [libcxx][ranges] implements dangling, borrowed_iterator_t, borrowed_subrange_t
* Implements part of P0896 'The One Ranges Proposal'
* Implements http://wg21.link/range.dangling

Reviewed By: zoecarver

Differential Revision: https://reviews.llvm.org/D105205
2021-07-21 21:34:13 +00:00
zoecarver 1a29403d2f [libcxx][ranges] Add common_iterator.
Differential Revision: https://reviews.llvm.org/D103335
2021-07-20 08:12:44 -07:00
Christopher Di Bella e37bbfe59c [libcxx][modules] protects users from relying on libc++ detail headers (1/n)
libc++ has started splicing standard library headers into much more
fine-grained content for maintainability. It's very likely that outdated
and naive tooling (some of which is outside of LLVM's scope) will
suggest users include things such as `<__algorithm/find.h>` instead of
`<algorithm>`, and Hyrum's law suggests that users will eventually begin
to rely on this without the help of tooling. As such, this commit
intends to protect users from themselves, by making it a hard error for
anyone outside of the standard library to include libc++ detail headers.

This is the first of four patches. Patch #2 will solve the problem for
pre-processor `#include`s; patches #3 and #4 will solve the problem for
`<__tree>` and `<__hash_table>` (since I've never touched the test cases
that are failing for these two, I want to split them out into their own
commits to be extra careful). Patch #5 will concern itself with
`<__threading_support>`, which intersects with libcxxabi (which I know
even less about).

Differential Revision: https://reviews.llvm.org/D105932
2021-07-16 22:39:18 +00:00
Christopher Di Bella 6cb05ca392 [libcxx][modularisation] adds several headers to the module map
* <__algorithm/iter_swap.h>
* <__algorithm/swap_ranges.h>
* <__functional/is_transparent.h>
* <__memory/uses_allocator.h>
* <__ranges/drop_view.h>
* <__ranges/transform_view.h>
* <shared_mutex>
* <span>

Also updates header inclusions that were affected.

**NOTE:** This is a proper subset of D105932. Since the content has
already been LGTM'd, I intend to merge this patch without review,
pending green CI. I decided it would be better to move these changes
into their own commit since the former patch has undergone further
changes and will need yet another light review. In the event any of
that gets rolled back (for whatever reason), the changes in this patch
won't be affected.

Differential Revision: https://reviews.llvm.org/D106040
2021-07-16 16:06:54 +00:00
Mark de Wever 321c2ea91c [libc++][NFC] Move monostate to its own header.
The format library uses `std::monostate`, but not a `std::variant`.
Moving `std::monostate` to its own header allows the format library to
reduce the amount of included code.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D105582
2021-07-08 17:35:26 +02:00
Louis Dionne 6829db727e [libc++] Implement copyable-box from Ranges
Differential Revision: https://reviews.llvm.org/D102135
2021-07-07 06:14:24 -04:00
Louis Dionne 5d2511c389 [libc++] NFC: Sort header lists and remove outdated comments in modulemap 2021-07-06 14:45:52 -04:00
Christopher Di Bella 8517a26d44 [libcxx][modularisation] splices `<iterator>` into individual headers
Differential Revision: https://reviews.llvm.org/D105076
2021-07-06 17:59:21 +00:00
Louis Dionne 681aa574c0 [libc++] NFC: Sort headers in CMakeLists.txt 2021-07-05 09:25:15 -04:00
Christopher Di Bella 050b064f15 [libcxx][functional][modular] splices <functional> into modular headers
Differential Revision: https://reviews.llvm.org/D104942
2021-07-01 14:01:49 -04:00
Louis Dionne d03aa7d6b6 [libc++] NFCI: Remove __functional/search.h
The __search helper function was once split into __functional for circular
dependency reasons, however this is not an issue anymore now that we have
finer grained headers.
2021-06-29 11:40:47 -04:00
Louis Dionne f32f3db9fc [libc++] Split the various iterator types out of <iterator>
Differential Revision: https://reviews.llvm.org/D104669
2021-06-28 12:25:40 -04:00
Christopher Di Bella 69d5a66621 [libcxx][modularisation] splits `<utility>` into self-contained headers
* moves `std::hash` and `std::unary_function` into `__functional`
* Everything else goes into `__utility/${NAME}.h`

Differential Revision: https://reviews.llvm.org/D104002
2021-06-25 00:29:01 +00:00
Christopher Di Bella 6adbc83ee9 [libcxx][modularisation] moves <utility> content out of <type_traits>
Moves:

* `std::move`, `std::forward`, `std::declval`, and `std::swap` into
  `__utility/${FUNCTION_NAME}`.
* `std::swap_ranges` and `std::iter_swap` into
  `__algorithm/${FUNCTION_NAME}`

Differential Revision: https://reviews.llvm.org/D103734
2021-06-24 17:57:29 +00:00
Louis Dionne 87dbe6c4ef [libc++] NFC: Add missing all.h to the modulemap 2021-06-22 13:47:41 -04:00
zoecarver 40d6d2c49d [libcxx][ranges] Add `ranges::iter_swap`.
Differential Revision: https://reviews.llvm.org/D102809
2021-06-22 09:52:40 -07:00
Louis Dionne 134723edd5 [libcxx] Move all algorithms into their own headers
This is a fairly mechanical change, it just moves each algorithm into
its own header. This is intended to be a NFC.

This commit re-applies 7ed7d4ccb8, which was reverted in 692d7166f7
because the Modules build got broken. The modules build has now been
fixed, so we're re-committing this.

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

Attribution note
----------------
I'm only committing this. This commit is a mix of D103583, D103330 and
D104171 authored by:

Co-authored-by: Christopher Di Bella <cjdb@google.com>
Co-authored-by: zoecarver <z.zoelec2@gmail.com>
2021-06-19 07:49:06 -04:00
Christopher Di Bella d827af03bc [libcxx][module-map] 🎨 updates module map to account for ranges headers
Corresponding module map update for D104414, split out for rollback
reasons.

Differential Revision: https://reviews.llvm.org/D104415
2021-06-17 16:52:35 +00:00
Christopher Di Bella c5076d8371 Revert "Revert "[libcxx][module-map] creates submodules for private headers""
This reverts commit d9633f229c as a
workaround was discovered.

Differential Revision: https://reviews.llvm.org/D104170
2021-06-16 16:36:41 +00:00
Petr Hosek 692d7166f7 Revert "[libcxx][gardening] Move all algorithms into their own headers."
This reverts commit 7ed7d4ccb8 as it
uncovered a Clang bug PR50592.
2021-06-07 17:15:20 -07:00
Petr Hosek d9633f229c Revert "[libcxx][module-map] creates submodules for private headers"
This reverts commit f1417eb9b1 as it
uncovered a Clang bug PR50592.
2021-06-07 17:10:05 -07:00
zoecarver 7ed7d4ccb8 [libcxx][gardening] Move all algorithms into their own headers.
This is a fairly mechanical change, it just moves each algorithm into its own header. This is a NFC.

Note: during this change, I burned down all the includes, so this follows "include only and exactly what you use."

Differential Revision: https://reviews.llvm.org/D103583
2021-06-04 09:37:12 -07:00
Christopher Di Bella f1417eb9b1 [libcxx][module-map] creates submodules for private headers
Most of our private headers need to be treated as submodules so that
Clang modules can export things correctly. Previous commits that split
monolithic headers into smaller chunks were unaware of this requirement,
and so this is being addressed in one fell swoop. Moving forward, most
new headers will need to have their own submodule (anything that's
conditionally included is exempt from this rule, which means `__support`
headers aren't made into submodules).

This hasn't been marked NFC, since I'm not 100% sure that's the case.

Differential Revision: https://reviews.llvm.org/D103551
2021-06-03 18:18:30 +00:00
Louis Dionne 05d164b25c Revert "[libc++] NFC: Move unwrap_iter to its own header"
This reverts commit 924ea3bb53 *again*, this time because it broke the
LLDB build with modules. We need to figure out what's up with the libc++
modules build once and for all.

Differential Revision: https://reviews.llvm.org/D103369
2021-06-02 15:58:27 -04:00
Louis Dionne 924ea3bb53 [libc++] NFC: Move unwrap_iter to its own header
This re-applies 9968896cd6, which was reverted in b13edf6e90 because
it broke the build.

Differential Revision: https://reviews.llvm.org/D103369
2021-06-01 21:46:59 -04:00
Arthur O'Dwyer c9385297ce [libc++] [modules] Add __threading_support to the modulemap.
It looks to me as if *every* helper header needs to be added to the modulemap,
actually; which is unfortunate since we keep proliferating them at such a
rapid pace.
2021-05-29 19:54:38 -04:00
Arthur O'Dwyer 0b10bb7ddd [libc++] Move <__sso_allocator> out of include/ into src/. NFCI.
This allocator is not intended for libc++'s users to use;
it's strictly an implementation detail of `src/locale.cpp`.
So, move it to the `src/include/` directory.

Drive-by const-qualify its comparison operators.

For consistency with `__hidden_allocator` (defined in `src/thread.cpp`),
do *not* remove it from "libcxx/lib/libc++unexp.exp",
"libcxx/utils/symcheck-blacklists/linux_blacklist.txt", etc.

Differential Revision: https://reviews.llvm.org/D101293
2021-05-05 16:20:52 -04:00
Christopher Di Bella 5a3309f825 [libcxx][ranges] adds `range` access CPOs
* `std::ranges::begin`
* `std::ranges::cbegin`
* `std::ranges::end`
* `std::ranges::cend`
* `std::ranges::iterator` (required for `end`)

Implements parts of:
    * P0896R4 The One Ranges Proposal`

Co-author: @zoecarver

Depends on D90999, D100160.

Differential Revision: https://reviews.llvm.org/D100255
2021-04-30 16:56:42 +00:00
Mark de Wever 01ace074fc [libc++] Implements ranges::enable_borrowed_range
This is the initial patch to implement ranges in libc++.

Implements parts of:
- P0896R4 One Ranges Proposal
- P1870 forwarding-range is too subtle
- LWG3379 in several library names is misleading

Reviewed By: ldionne, #libc, cjdb, zoecarver, Quuxplusone

Differential Revision: https://reviews.llvm.org/D90999
2021-04-18 13:35:08 +02:00
Mark de Wever 081c1db02d [libc++] Implement format_error.
This is the first step at implementing <format>. It adds the <format> header
and implements the `format_error`. class.

Implemnts parts of:
-P0645 Text Formatting

Reviewed By: ldionne, #libc, miscco, curdeius

Differential Revision: https://reviews.llvm.org/D92214
2021-01-28 18:02:53 +01:00
Thorsten Schütt b973e2e2f2 [libc++] Introduce __bits
It has the low-level bit fiddling operations from bit. It eliminates a cyclic dependency between __bit_reference, bits, and vector. I want to exploit this in later patches.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D94908
2021-01-22 21:20:23 +01:00
Raul Tambre 4f6c4b473c [libc++] Implement <numbers>
Summary: Constants have 33 significant decimal digits for IEEE 754 128-bit floating-point numbers.

Reviewers: ldionne, #libc, EricWF, zoecarver, curdeius

Reviewed By: ldionne, #libc, curdeius

Differential Revision: https://reviews.llvm.org/D77505
2020-06-19 14:25:02 +05:30
Eric Fiselier 601f763182 [libcxx] Adds [concept.same]
Patch from Christopher Di Bella (cjdb@google.com)
Reviewed as https://reviews.llvm.org/D74291

Adds `std::same_as` to libc++. Since there aren't clang-format rules for
//requires-expressions//, I'll need to disable the formatter in certain areas.
2020-04-08 18:00:13 -04:00
Raphael Isemann b61e83eb0e [libc++] Give headers that require C++14 a cplusplus14 requires in the modulemap
https://reviews.llvm.org/D68480 added those headers and made the std module
only usable with C++14 or later as the submodules were not marked as requiring
C++14 or later. This just adds the missing requires directives.
2020-02-24 20:20:55 +01:00
Olivier Giroux 54fa9ecd30 [libc++] Implementation of C++20's P1135R6 for libcxx
Differential Revision: https://reviews.llvm.org/D68480
2020-02-24 10:59:35 -05:00
Louis Dionne 0a06eb911b [libc++] Take 2: Integrate the PSTL into libc++
Summary:
This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when
configuring libc++ in CMake. When that option is enabled, libc++ will
assume that the PSTL can be found somewhere on the CMake module path,
and it will provide the C++17 parallel algorithms based on the PSTL
(that is assumed to be available).

The commit also adds support for running the PSTL tests as part of
the libc++ test suite.

The first attempt to commit this failed because it exposed a bug in the
tests for modules. Now that this has been fixed, it should be safe to
commit this.

Reviewers: EricWF

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

Tags: #libc

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

llvm-svn: 367903
2019-08-05 18:29:14 +00:00
Louis Dionne a3c83b7511 Revert "[libc++] Integrate the PSTL into libc++"
This reverts r366593, which caused unforeseen breakage on the build bots.
I'm reverting until the problems have been figured out and fixed.

llvm-svn: 366603
2019-07-19 18:52:46 +00:00
Louis Dionne 910323e667 [libc++] Integrate the PSTL into libc++
Summary:
This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when
configuring libc++ in CMake. When that option is enabled, libc++ will
assume that the PSTL can be found somewhere on the CMake module path,
and it will provide the C++17 parallel algorithms based on the PSTL
(that is assumed to be available).

The commit also adds support for running the PSTL tests as part of
the libc++ test suite.

Reviewers: rodgert, EricWF

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

Tags: #libc

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

llvm-svn: 366593
2019-07-19 17:02:42 +00:00
Brian Gesiak b66754a29e Revert "[coroutines] Add std::experimental::task<T> type"
This revision is causing build and test failures, such as
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-armv8-linux/builds/648/steps/test.libcxx/logs/stdio,
so I'll revert it.

llvm-svn: 357023
2019-03-26 19:50:46 +00:00
Brian Gesiak 57839425aa [coroutines] Add std::experimental::task<T> type
Summary:
Adds the coroutine `std::experimental::task<T>` type described in proposal P1056R0.
See https://wg21.link/P1056R0.

This implementation allows customization of the allocator used to allocate the
coroutine frame by passing std::allocator_arg as the first argument, followed by
the allocator to use.

This supports co_awaiting the same task multiple times. The second and
subsequent times it returns a reference to the already-computed value.

This diff also adds some implementations of other utilities that have potential for
standardization as helpers within the test/... area:
- `sync_wait(awaitable)` - See P1171R0
- `manual_reset_event`

Move the definition of the __aligned_allocation_size helper function
from <experimental/memory_resource> to <experimental/__memory>
so it can be more widely used without pulling in memory_resource.

Outstanding work:
- Use C++14 keywords directly rather than macro versions
  eg. use `noexcept` instead of `_NOEXCEPT`).
- Add support for overaligned coroutine frames.
  This may need wording in the Coroutines TS to support passing the extra `std::align_val_t`.
- Eliminate use of `if constexpr` if we want it to compile under C++14.

Patch by @lewissbaker (Lewis Baker).

llvm-svn: 357010
2019-03-26 17:46:06 +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
Louis Dionne 9a494eacba [libcxx] Remove dynarray
Summary:
std::dynarray had been proposed for C++14, but it was pulled out from C++14
and there are no plans to standardize it anymore.

Reviewers: mclow.lists, EricWF

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

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

llvm-svn: 347783
2018-11-28 18:02:00 +00:00
Marshall Clow e02ee4f013 Recommit r339943 - Establish the <bit> header. NFC yet. Reviewed as https://reviews.llvm.org/D50815 - with a fix for the sanitizer bots
llvm-svn: 340045
2018-08-17 16:07:48 +00:00
Vitaly Buka 0d52fce74d Revert "Establish the <bit> header. NFC yet. Reviewed as https://reviews.llvm.org/D50815"
Breaks build on sanitizer bots.

This reverts commit r339943.

llvm-svn: 339971
2018-08-16 23:57:16 +00:00
Marshall Clow 496bb865c6 Establish the <bit> header. NFC yet. Reviewed as https://reviews.llvm.org/D50815
llvm-svn: 339943
2018-08-16 21:35:38 +00:00
Zhihao Yuan d27489645b [libc++][C++17] Elementary string conversions for integral types
Summary:
Major QoI considerations:

- The facility is backported to C++14, same as libstdc++.
- Efforts have been made to minimize the header dependencies.
- The design is friendly to the uses of MSVC intrinsics (`__emulu`, `_umul128`, `_BitScanForward`, `_BitScanForward64`) but not implemented; future contributions are welcome.

Thanks to Milo Yip for contributing the implementation of `__u64toa` and `__u32toa`.

References:
 https://wg21.link/p0067r5
 https://wg21.link/p0682r1

Reviewers: mclow.lists, EricWF

Reviewed By: mclow.lists

Subscribers: ldionne, Quuxplusone, christof, mgorny, cfe-commits

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

llvm-svn: 338479
2018-08-01 02:38:30 +00:00
Erik Pilkington b0386a515b First half of C++17's splicing maps and sets
This commit adds a node handle type, (located in __node_handle), and adds
extract() and insert() members to all map and set types, as well as their
implementations in __tree and __hash_table.

The second half of this feature is adding merge() members, which splice nodes
in bulk from one container into another. This will be committed in a follow-up.

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

llvm-svn: 338472
2018-08-01 01:33:38 +00:00
Eric Fiselier 998a5c8831 Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.

Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).

The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).

Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.

In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.

llvm-svn: 338093
2018-07-27 03:07:09 +00:00
Marshall Clow 8a0794b722 Implement <span>. Reviewed as https://reviews.llvm.org/D49338
llvm-svn: 337804
2018-07-24 03:01:02 +00:00
Zhihao Yuan 4f4effd6ee [libc++] Lift std::errc into a separated header
Summary: This is needed to implement `<charconv>`, otherwise `<charconv>` would need to include `<system_error>`, which pulls in `<string>` -- a header which the `<charconv>` proposal intends to keep away from.

Reviewers: mclow.lists, EricWF

Reviewed By: mclow.lists

Subscribers: christof, cfe-commits

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

llvm-svn: 336164
2018-07-03 03:25:10 +00:00
Tim Shen 403c667b4b Re-commit r330627 "[libcxx] implement <experimental/simd> declarations based on P0214R7."
There are 3 changes:
* Renamed genertor.pass.cpp to generator.pass.cpp
* Removed nothing_to_do.pass.cpp
* Mark GCC 4.9 as UNSUPPORTED for the test files that have negative
  narrowing conversion SFINAE test (see GCC PR63723).

llvm-svn: 330655
2018-04-23 21:54:06 +00:00
Tim Shen f72b208576 Revert "[libcxx] implement <experimental/simd> declarations based on P0214R7."
This reverts commit r330627.

This causes several bots to freak out.

llvm-svn: 330636
2018-04-23 19:56:20 +00:00
Tim Shen 6a72ef6c4b [libcxx] implement <experimental/simd> declarations based on P0214R7.
Summary:
The patch includes all declarations, and also implements the following features:
* ABI.
* narrowing-conversion related SFIANE, including simd<> ctors and (static_)simd_cast.

Reviewers: mclow.lists, EricWF

Subscribers: lichray, sanjoy, MaskRay, cfe-commits

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

llvm-svn: 330627
2018-04-23 18:47:07 +00:00
Eric Fiselier 0913ca1978 Implement P0768r1: Library support for the Spaceship Operator.
this patch adds the <compare> header and implements all of it
except for [comp.alg].

As I understand it, the header is needed by the compiler in
when implementing the semantics of operator<=>. For that reason
I feel it's important to land this header early, despite
all compilers lacking support.

llvm-svn: 329460
2018-04-06 21:37:23 +00:00
Eric Fiselier acc32abb11 Touch up tests for new <version> header; fix module.modulemap.
This patch does some housekeeping for the new <version> header.
It adds it to the module.modulemap, and the double_include.sh.cpp test.

Additionally it corrects the // UNSUPPORTED options for the libc++
specific test. The header needs to compile under C++03 to support
modules, and it should compile under all available compilers.

llvm-svn: 329144
2018-04-04 04:21:54 +00:00
Marshall Clow a3d37f0716 Remove more of the std::experimental bits that are now in std::. All the _v type aliases, conjunction/disjunction, apply, etc. See https://libcxx.llvm.org/TS_deprecation.html
llvm-svn: 324423
2018-02-06 23:13:48 +00:00
Marshall Clow 372d4183cb Remove <experimental/string_view>; use <string_view> instead. See https://libcxx.llvm.org/TS_deprecation.html
llvm-svn: 324290
2018-02-05 23:43:34 +00:00
Marshall Clow 91af9048b2 Remove <experimental/numeric>; use <numeric> instead. See https://libcxx.llvm.org/TS_deprecation.html
llvm-svn: 323975
2018-02-01 15:49:27 +00:00
Marshall Clow 5d8babe30d Remove <experimental/any>; use <any> instead. See https://libcxx.llvm.org/TS_deprecation.html
llvm-svn: 323972
2018-02-01 15:21:14 +00:00
Marshall Clow 040533215a Remove <experimental/optional>; use <optional> instead. See https://libcxx.llvm.org/TS_deprecation.html
llvm-svn: 323971
2018-02-01 14:54:25 +00:00
Eric Fiselier a016efb1dc [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows
Summary:
This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning.
This patch changes libc++ to use `#pragma push_macro`  to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header.

Reviewers: mclow.lists, bcraig, compnerd, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits, krytarowski

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

llvm-svn: 304357
2017-05-31 22:07:49 +00:00
Eric Fiselier a607ba6134 Add missing 'requires coroutines' to module map
llvm-svn: 304180
2017-05-29 23:17:28 +00:00
Eric Fiselier ea96891fb4 Re-add <experimental/coroutine> to the module map.
The original issues were caused because <experimental/coroutine>
didn't correctly #ifdef out enough of the header, which caused incomplete
types to be used.

This patch fixes the `#if defined(__cpp_coroutines)` guard and re-adds
the headers to the module map.

It also uglifies some incorrectly non-reserved names.

llvm-svn: 303936
2017-05-25 23:39:29 +00:00
Eric Fiselier 39b56d80a1 Remove <experimental/coroutine> from the module map for now. It doesn't work unless modules are enabled
llvm-svn: 303838
2017-05-25 05:30:05 +00:00
Eric Fiselier 3ca9185073 Add <experimental/coroutine>
This patch adds the library portions of the coroutines PDTS,
which should now be supported by Clang.

llvm-svn: 303836
2017-05-25 04:36:24 +00:00
Eric Fiselier cd71f447b7 [libc++] Tolerate presence of __deallocate macro
Summary:
On Windows the identifier `__deallocate` is defined as a macro by one of the Windows system headers. Previously libc++ worked around this by `#undef __deallocate` and generating a warning. However this causes the WIN32 version of `__threading_support` to always generate a warning on Windows. This is not OK.

This patch renames all usages of `__deallocate` internally as to not conflict with the macro.

Reviewers: mclow.lists, majnemer, rnk, rsmith, smeenai, compnerd

Subscribers: cfe-commits

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

llvm-svn: 291332
2017-01-07 03:01:24 +00:00
Eric Fiselier 900efb2f1a Fix _LIBCPP_VERSION tests with modules on Darwin
llvm-svn: 289028
2016-12-08 06:37:41 +00:00
Eric Fiselier 2c482d3f01 Revert r288787: Add missing stdbool.h module.
Reverting because I didn't properly test this patch. Although it's probably
correct to add a stdbool_h module I thought the change fixed more than it did.
I'll re-commit after more investigation.

llvm-svn: 288789
2016-12-06 09:48:32 +00:00
Eric Fiselier d9cbffb0df Add missing stdbool.h module. The test suite now passes on OS X with modules
llvm-svn: 288787
2016-12-06 09:41:50 +00:00
Eric Fiselier 4facc13108 Fix stdio module build on OS X
llvm-svn: 288778
2016-12-06 07:40:46 +00:00
Eric Fiselier 25af0418da Fix C++03 modules build
llvm-svn: 288755
2016-12-06 01:34:24 +00:00
Eric Fiselier e1f72557c2 Add module definitions for <experimental/foo> headers
llvm-svn: 288735
2016-12-05 23:55:34 +00:00
Eric Fiselier ca648c9787 Add module definitions for string_view
llvm-svn: 288733
2016-12-05 23:53:23 +00:00
Eric Fiselier 392aa10811 Add modules for any/optional/variant
llvm-svn: 288730
2016-12-05 23:33:19 +00:00
Eric Fiselier daf21c3f69 Adjust libc++ test infastructure to fully support modules
This patch overhalls the libc++ test format/configuration in order to fully support modules. By "fully support" I mean get almost all of the tests passing. The main hurdle for doing this is handling tests that `#define _LIBCPP_FOO` macros to test a different configuration. This patch deals with these tests in the following ways:

1. For tests that define single `_LIBCPP_ABI_FOO` macros have been annotated with `// MODULES_DEFINES: _LIBCPP_ABI_FOO`. This allows the test suite to define the macro on the command line so it uses a different set of modules.
2. Tests for libc++'s debug mode (which define custom `_LIBCPP_ASSERT`) are automatically detected by the test suite and are compiled and run with modules disabled.

This patch also cleans up how the `CXXCompiler` helper class handles enabling/disabling language features.

NOTE: This patch uses `LIT` features which were only committed to LLVM today. If this patch breaks running the libc++ tests you probably need to update LLVM.
llvm-svn: 288728
2016-12-05 23:16:07 +00:00
Eric Fiselier 198955536e Allow libc++ to use modules in C++03.
Libc++ internal uses <atomic> in C++03 code but the module map forbids its use.
This causes the libc++ 'std' module to fail to build in C++03.

This patch removes the requirement to fix this issue.

llvm-svn: 287693
2016-11-22 20:15:39 +00:00
Eric Fiselier 7216b6bc38 Attempt to fix stdint/cstdint modules try 2
llvm-svn: 287690
2016-11-22 20:05:19 +00:00
Eric Fiselier 3028189ee3 Cleanup module.modulemap
llvm-svn: 287687
2016-11-22 20:00:21 +00:00
Eric Fiselier 67a7e935a3 Revert r287435 because of OS X test failures
llvm-svn: 287531
2016-11-21 11:26:10 +00:00
Eric Fiselier 72d302b9ed Fix stdint/cstdint modules
llvm-svn: 287435
2016-11-19 03:29:03 +00:00
Eric Fiselier 074d46d55f [libcxx] Implement locale.h to fix modules build
Summary:
Because `locale.h` isn't part of the libc++ modules the class definitions it provides are exported as part of `__locale` (since it happens to be build first). This breaks `<clocale>` which exports `std::lconv` without including `<__locale>`.

This patch implements `locale.h` to fix this issue, it also adds support for testing libc++ with modules.




Reviewers: mclow.lists, rsmith, EricWF

Subscribers: cfe-commits

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

llvm-svn: 287413
2016-11-19 01:14:15 +00:00
Bruno Cardoso Lopes 81440dc93f [ModuleMap] Add more module entries to cover some non modular headers
These modules are necessary on Darwin to allow modules with
'no_undeclared_includes' (introduced in clang r284797) to work properly
while using libc++ headers.

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

llvm-svn: 284801
2016-10-21 03:14:27 +00:00
Richard Smith d3a7bfcde5 Remove __config module to avoid #include cycle when libc headers include libc++'s <foo.h> headers.
llvm-svn: 250236
2015-10-13 22:13:33 +00:00
Saleem Abdulrasool 8e5ce33193 Handle function name conflicts in _LIBCPP_MSVCRT mode
Visual Studio's SAL extension uses a macro named __deallocate. This macro is
used pervasively, and gets included through various different ways. This
conflicts with the similarly named interfaces in libc++. Introduce a undef
header similar to __undef_min_max to handle this. This fixes a number of errors
due to the macro replacing the function name.

llvm-svn: 229162
2015-02-13 22:15:32 +00:00
Nico Weber 28d692d30e Mark module atomic as cplusplus11.
With clang, the header atomic requires __has_feature(cxx_atomic), which is only
true in c++11 mode. Because of this, when using modules in c++98 with libc++
compilation of the std module would fail without this change, PR21002.

(With gcc, only gcc4.7+ is needed, no c++11. But gcc doesn't have modules yet,
and the module.modulemap language can't express things like "this is only
required if the compiler is clang". If gcc gets module support, we'd probably
have a module.modulemap file for each compiler that libc++ supports?)

llvm-svn: 218372
2014-09-24 04:44:54 +00:00
Richard Smith 80fd10e6e1 [modules] Add initial module map for libc++.
llvm-svn: 209265
2014-05-21 00:33:49 +00:00