Commit Graph

33 Commits

Author SHA1 Message Date
Hristo Hristov
ed276dff46
[libc++][memory] P2868R1: Removing deprecated typedef std::allocator::is_always_equal (#78562)
Implements:
- https://wg21.link/P2868R1
- https://wg21.link/LWG3170

---------

Co-authored-by: Zingam <zingam@outlook.com>
2024-01-20 06:07:19 +02:00
Louis Dionne
4c19854222
[libc++] Rename _LIBCPP_INLINE_VISIBILITY to _LIBCPP_HIDE_FROM_ABI (#74095)
In preparation for running clang-format on the whole code base, we are
also removing mentions of the legacy _LIBCPP_INLINE_VISIBILITY macro in
favor of the newer _LIBCPP_HIDE_FROM_ABI.

We're still leaving the definition of _LIBCPP_INLINE_VISIBILITY to avoid
creating needless breakage in case some older patches are checked-in
with mentions of the old macro. After we branch for LLVM 18, we can do
another pass to clean up remaining uses of the macro that might have
gotten introduced by mistake (if any) and remove the macro itself at the
same time. This is just a minor convenience to smooth out the transition
as much as possible.

See
https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all
for the clang-format proposal.
2023-12-04 10:25:14 -05:00
Nikolas Klauser
8b73be5f57 [libc++] Readd _LIBCPP_CONSTINIT
This isn't used by libc++, but it's still used in libc++abi.
2023-11-13 13:07:32 +01:00
Nikolas Klauser
9e618e5ed4 [libc++][NFC] Remove a few unused macros from <__config> 2023-11-13 12:57:59 +01:00
Nikolas Klauser
3583bf3ad8 [libc++] Make everything in namespace std have default type visibility and hidden visibility and remove _LIBCPP_ENUM_VIS
This avoids having to add `_LIBCPP_ENUM_VIS`, since that is handled through `type_visibility` and GCC always makes the visibility of enums default. It also fixes and missing `_LIBCPP_EXPORTED_FROM_ABI` on classes when using Clang.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D153658
2023-08-19 15:16:04 -07:00
Louis Dionne
5b666cf11e [libc++] Fix thread annotations on shared_mutex and shared_timed_mutex
Based on the comment in https://reviews.llvm.org/D54290#4418958, these
attributes need to be on the top-level functions in order to work
properly. Also, add tests.

Fixes http://llvm.org/PR57035.

Differential Revision: https://reviews.llvm.org/D154354
2023-07-06 08:37:10 -04:00
Louis Dionne
b7bc8033f1 [libc++][NFC] Sort list of attribute macros in the .clang-format file 2023-07-04 11:25:46 -04:00
Louis Dionne
5a6e6adb91 [libc++] Make sure our .clang-format is used for all languages
In particular, this ensures that it is used for Objective-C and
Objective-C++, since we have a few files that get detected as that.

Differential Revision: https://reviews.llvm.org/D153289
2023-06-20 15:00:53 -04:00
Nikolas Klauser
f1ea0b11ca [libc++] Merge _LIBCPP_FUNC_VIS, _LIBCPP_TYPE_VIS and _LIBCPP_EXCEPTION_ABI into _LIBCPP_EXPORTED_FROM_ABI
These macros are always defined identically, so we can simplify the code a bit by merging them.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, krytarowski, smeenai

Differential Revision: https://reviews.llvm.org/D152652
2023-06-15 08:56:45 -07:00
Nikolas Klauser
7949ee0d4f [libc++] Introduce __is_pointer_in_range
This checks whether a pointer is within a range, even during constant evaluation. This allows running optimized code paths during constant evaluation, instead of falling back to the general-purpose implementation all the time. This is also a central place for comparing unrelated pointers, which is technically UB.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D143327
2023-06-07 13:33:58 -07:00
Louis Dionne
c6b12b7c3b [libc++] Remove _LIBCPP_CONSTEVAL
It was only used in one place, and it seems entirely valid to use
constexpr unconditionally in that location.

Note that a different change was attempted, i.e. using consteval
unconditionally. However, this led to http://llvm.org/PR60709.

Differential Revision: https://reviews.llvm.org/D145700
2023-03-10 09:04:48 -05:00
Mark de Wever
de6827b530 [libc++] Improves clang-format settings.
Add a new test based .clang-format file which inherits from the generic
one. This moves some test specific formatting rules to the test
directory.

The main benefit is that headers are sorted, which makes it more likely
to catch these errors before creating a review instead of spotting the
error in the CI clang-tidy step.

Reviewed By: ldionne, philnik, #libc

Differential Revision: https://reviews.llvm.org/D144755
2023-02-27 19:24:06 +01:00
Hans Wennborg
bbff77a14e Revert "[libc++] Remove _LIBCPP_CONSTEVAL"
It causes mysterious memory leaks when comparing std::string, see GitHub
Issue #60709 and the code review.

> All supported compilers support `consteval`, so there is no more need for the macro.
>
> Reviewed By: ldionne, Mordante, #libc
>
> Spies: libcxx-commits
>
> Differential Revision: https://reviews.llvm.org/D143489

This reverts commit aaef3b82f4.
2023-02-13 16:29:57 +01:00
Nikolas Klauser
aaef3b82f4 [libc++] Remove _LIBCPP_CONSTEVAL
All supported compilers support `consteval`, so there is no more need for the macro.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D143489
2023-02-11 18:34:40 +01:00
Nikolas Klauser
5146b57b40 [libc++][NFC] Rename the constexpr macros
This was discussed on Discord with the consensus that we should rename the macros.

Reviewed By: ldionne, Mordante, var-const, avogelsgesang, jloser, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D131498
2022-08-19 15:35:02 +02:00
Nikolas Klauser
d5a3cc1d88 [libc++] Fix merge-conflict in .clang-format 2022-07-28 10:32:02 +02:00
Nikolas Klauser
e01b4fe956 [libc++] Fix unwrapping ranges with different iterators and sentinels
Reviewed By: ldionne, huixie90, #libc

Spies: arichardson, sstefan1, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D129040
2022-07-28 10:22:41 +02:00
Mark de Wever
582b7d3ff0 [libc++] Update clang-format style.
After evaluating the new style I noticed inner namespaces are now
indented. I am not fond of that style and I've seen some other review
comment in this regard so I propose we remove this option and use the
LLVM default not to indent it.

Reviewed By: ldionne, philnik, var-const, #libc

Differential Revision: https://reviews.llvm.org/D129441
2022-07-27 18:18:44 +02:00
owenca
462b49f18c [libcxx] Remove extraneous '---' lines in .clang-format files 2022-06-15 01:34:37 -07:00
Nikolas Klauser
e7c72d69ac [libc++] Find a clang-format everybody is happy with
We decided that we want to use clang-format for libc++ but we haven't decided yet how the code should be formatted. We should probably discuss things on discord. This PR is mostly to show how the clang-format would look like and to commit to one once we decided on it. I'll remove the `<string>` diff when I commit this PR.

Reviewed By: ldionne

Spies: EricWF, dschuff, krytarowski, fedor.sergeev, aheejin, mstorsjo, phosek, abrachet, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D124789
2022-06-14 20:12:33 +02:00
Nikolas Klauser
ac251726f8 [libc++][NFC] clang-format <__config>
It's not perfect, but it's a lot better than the status quo.

Reviewed By: ldionne, #libc

Spies: EricWF, aheejin, libcxx-commits, dschuff, krytarowski, fedor.sergeev, mstorsjo, phosek, abrachet

Differential Revision: https://reviews.llvm.org/D127644
2022-06-14 06:47:38 +02:00
Mark de Wever
4cb3d7d7b4 [libc++] Update clang-format to C++20.
We now use clang-format-13 which has the option SpacesInAngles. This
allows us to switch the default language version to C++20, which should
avoid breaking code when formatting due to the adding of whitespace.
For example `u8"foo"` no longer is formatted as `u8 "foo"`.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D112728
2021-10-30 12:50:57 +02:00
Mark de Wever
15dfe78340 [NFC][libc++] Update clang-format style.
Changes the style as requested by @ldionne in D103368.

Reviewed By: ldionne, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D109835
2021-09-24 19:28:07 +02:00
Christopher Di Bella
6f3bce911e [libcxx][NFC] removes IndentRequires from .clang-format
IndentRequires is apparently breaking CI because it uses an older clang-format.

Partially rolls back 2e3a78b8ca.
2021-04-15 19:28:45 +00:00
Christopher Di Bella
ff0ada4e16 [libcxx][NFC] removes BreakBeforeConceptDeclarations from .clang-format
BreakBeforeConceptDeclarations is apparently breaking CI.

Partially rolls back 2e3a78b8ca.
2021-04-15 15:29:07 +00:00
Christopher Di Bella
2e3a78b8ca [libcxx][NFC] adjusts formatting rules
This will reduce the amount of noisy feedback during reviews.

Differential Revision: https://reviews.llvm.org/D99691
2021-04-15 02:46:44 +00:00
Eric Fiselier
73b76bcf2f Make clang-format use C++03 syntax
llvm-svn: 300387
2017-04-15 02:45:43 +00:00
Eric Fiselier
1d0d456819 Tweak .clang-format configuration.
Remove the custom configuration options for brace wrapping. They
don't work well for inline functions or type-traits classes.

llvm-svn: 291998
2017-01-14 05:43:02 +00:00
Saleem Abdulrasool
720fb14cdd clang-format: tweak configuration
Update the configuration to reflect the style more accurately.  Pointers
are tied to the left.  Braces are split on classes/structs and
functions.

llvm-svn: 290857
2017-01-03 04:23:52 +00:00
Eric Fiselier
217c5d36bb fix misspelling in .clang-format
llvm-svn: 289178
2016-12-09 03:18:45 +00:00
Eric Fiselier
949e47daed Turn off header sorting and comment formatting
llvm-svn: 289177
2016-12-09 03:17:25 +00:00
Eric Fiselier
55b31b4e69 [libcxx] Fix max_size() across all containers
Summary: The `max_size()` method of containers should respect both the allocator's reported `max_size` and the range of the `difference_type`. This patch makes all containers choose the smallest of those two values.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 287729
2016-11-23 01:18:56 +00:00
Eric Fiselier
7004d6664e Add .clang-format to libc++
Adding a Clang Format file to libc++ and which style it should use has been
discussed a couple of times. This patch finally adds a .clang-format file
which specifies LLVM styles.

Personally I dislike how the LLVM style handles much of the meta-programming
in libc++. However the general consensus was that libc++ should prefer the
LLVM style and make adjustments where needed.

Note that using clang-format on changes is not required, especially for
changes within the headers. However formatting tests should be encouraged.

llvm-svn: 287020
2016-11-15 20:21:30 +00:00