[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
This commit is contained in:
Louis Dionne 2023-06-16 14:32:08 -04:00
parent 556b563ae0
commit 5a6e6adb91
4 changed files with 46 additions and 42 deletions

View File

@ -1,4 +1,7 @@
BasedOnStyle: LLVM
# Note that we don't specify the language in this file because some files are
# detected as Cpp, but others are detected as ObjC and we want this formatting
# to apply to all types of files.
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: Consecutive
@ -66,7 +69,6 @@ PackConstructorInitializers: NextLine
PenaltyIndentedWhitespace: 2
Language: Cpp
Standard: c++20
SpacesInAngles: Leave

View File

@ -313,8 +313,8 @@
# endif // __BYTE_ORDER__
# ifdef __FreeBSD__
# include <sys/endian.h>
# include <osreldate.h>
# include <sys/endian.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN
# else // _BYTE_ORDER == _LITTLE_ENDIAN
@ -681,7 +681,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
# define _LIBCPP_PREFERRED_OVERLOAD __attribute__((__enable_if__(true, "")))
# endif
#if !defined(__SIZEOF_INT128__) || defined(_MSC_VER)
# if !defined(__SIZEOF_INT128__) || defined(_MSC_VER)
# define _LIBCPP_HAS_NO_INT128
# endif
@ -699,7 +699,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
# ifdef _LIBCPP_CXX03_LANG
# define _LIBCPP_DECLARE_STRONG_ENUM(x) \
struct _LIBCPP_EXPORTED_FROM_ABI x { \
struct _LIBCPP_EXPORTED_FROM_ABI x { \
enum __lx
// clang-format off
# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
@ -807,11 +807,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
# define _LIBCPP_DEPRECATED_IN_CXX20
# endif
#if _LIBCPP_STD_VER >= 23
# define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED
#else
# define _LIBCPP_DEPRECATED_IN_CXX23
#endif
# if _LIBCPP_STD_VER >= 23
# define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED
# else
# define _LIBCPP_DEPRECATED_IN_CXX23
# endif
# if !defined(_LIBCPP_HAS_NO_CHAR8_T)
# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED
@ -1275,20 +1275,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
# endif
// TODO: Make this a proper configuration option
#define _PSTL_PAR_BACKEND_SERIAL
# define _PSTL_PAR_BACKEND_SERIAL
#define _PSTL_PRAGMA(x) _Pragma(# x)
# define _PSTL_PRAGMA(x) _Pragma(#x)
// Enable SIMD for compilers that support OpenMP 4.0
#if (defined(_OPENMP) && _OPENMP >= 201307)
# if (defined(_OPENMP) && _OPENMP >= 201307)
# define _PSTL_UDR_PRESENT
# define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd)
# define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd)
# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM))
# define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM))
# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM))
# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM))
# define _PSTL_UDR_PRESENT
# define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd)
# define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd)
# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM))
# define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM))
# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM))
# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM))
// Declaration of reduction functor, where
// NAME - the name of the functor
@ -1297,22 +1297,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
// omp_out - refers to the final value of the combiner operator
// omp_priv - refers to the private copy of the initial value
// omp_orig - refers to the original variable to be reduced
# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \
_PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig))
# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \
_PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig))
#else // (defined(_OPENMP) && _OPENMP >= 201307)
# else // (defined(_OPENMP) && _OPENMP >= 201307)
# define _PSTL_PRAGMA_SIMD
# define _PSTL_PRAGMA_DECLARE_SIMD
# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM)
# define _PSTL_PRAGMA_SIMD_SCAN(PRM)
# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM)
# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM)
# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP)
# define _PSTL_PRAGMA_SIMD
# define _PSTL_PRAGMA_DECLARE_SIMD
# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM)
# define _PSTL_PRAGMA_SIMD_SCAN(PRM)
# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM)
# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM)
# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP)
#endif // (defined(_OPENMP) && _OPENMP >= 201307)
# endif // (defined(_OPENMP) && _OPENMP >= 201307)
#define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
# define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
#endif // __cplusplus

View File

@ -18,7 +18,7 @@
#include <__type_traits/is_pointer.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@ -28,17 +28,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp> inline constexpr bool is_scalar_v = __is_scalar(_Tp);
#endif
# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_scalar_v = __is_scalar(_Tp);
# endif
#else // __has_builtin(__is_scalar)
template <class _Tp> struct __is_block : false_type {};
#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS)
template <class _Tp>
struct __is_block : false_type {};
# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS)
template <class _Rp, class... _Args>
struct __is_block<_Rp (^)(_Args...)> : true_type {};
#endif
# endif
// clang-format off
template <class _Tp>
@ -55,9 +57,10 @@ struct _LIBCPP_TEMPLATE_VIS is_scalar
template <>
struct _LIBCPP_TEMPLATE_VIS is_scalar<nullptr_t> : public true_type {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp> inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
#endif
# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
# endif
#endif // __has_builtin(__is_scalar)

View File

@ -149,7 +149,6 @@ libcxx/include/__compare/three_way_comparable.h
libcxx/include/__compare/weak_order.h
libcxx/include/complex
libcxx/include/condition_variable
libcxx/include/__config
libcxx/include/__coroutine/coroutine_handle.h
libcxx/include/__coroutine/coroutine_traits.h
libcxx/include/__coroutine/noop_coroutine_handle.h