Skip to content

Commit 4a184c0

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:40acaa394fa2 into amd-gfx:abc91debd3ba
Local branch amd-gfx abc91de Merged main:bc23ef3feba9 into amd-gfx:0060b1beee69 Remote branch main 40acaa3 [clang-format] Fix a crash in `QualifierAlignment: Right` (llvm#120821)
2 parents abc91de + 40acaa3 commit 4a184c0

36 files changed

+109
-101
lines changed

clang/lib/Format/QualifierAlignmentFixer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ const FormatToken *LeftRightQualifierAlignmentFixer::analyzeRight(
348348
}
349349
}
350350

351-
if (Next->is(tok::kw_auto))
351+
if (Next && Next->is(tok::kw_auto))
352352
TypeToken = Next;
353353

354354
// Place the Qualifier at the end of the list of qualifiers.

clang/unittests/Format/QualifierFixerTest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,11 @@ TEST_F(QualifierFixerTest, RightQualifier) {
531531
verifyFormat("float (C::*const p)(int);", Style);
532532
verifyFormat("float (C::*p)(int) const;", Style);
533533
verifyFormat("float const (C::*p)(int);", "const float (C::*p)(int);", Style);
534+
535+
Style.BreakBeforeBraces = FormatStyle::BS_Custom;
536+
Style.BraceWrapping.AfterFunction = true;
537+
verifyFormat("auto foo() -> T const { return bar; }",
538+
"auto foo() -> const T { return bar; }", Style);
534539
}
535540

536541
TEST_F(QualifierFixerTest, LeftQualifier) {

libcxx/include/__config

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,11 +1170,7 @@ typedef __char32_t char32_t;
11701170
# define _LIBCPP_NOESCAPE
11711171
# endif
11721172

1173-
# if __has_attribute(__nodebug__)
1174-
# define _LIBCPP_NODEBUG __attribute__((__nodebug__))
1175-
# else
1176-
# define _LIBCPP_NODEBUG
1177-
# endif
1173+
# define _LIBCPP_NODEBUG [[__gnu__::__nodebug__]]
11781174

11791175
# if __has_attribute(__standalone_debug__)
11801176
# define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__))

libcxx/include/__functional/function.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)> {
146146
_LIBCPP_COMPRESSED_PAIR(_Fp, __func_, _Ap, __alloc_);
147147

148148
public:
149-
typedef _LIBCPP_NODEBUG _Fp _Target;
150-
typedef _LIBCPP_NODEBUG _Ap _Alloc;
149+
using _Target _LIBCPP_NODEBUG = _Fp;
150+
using _Alloc _LIBCPP_NODEBUG = _Ap;
151151

152152
_LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __func_; }
153153

@@ -198,7 +198,7 @@ class __default_alloc_func<_Fp, _Rp(_ArgTypes...)> {
198198
_Fp __f_;
199199

200200
public:
201-
typedef _LIBCPP_NODEBUG _Fp _Target;
201+
using _Target _LIBCPP_NODEBUG = _Fp;
202202

203203
_LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __f_; }
204204

libcxx/include/__fwd/memory_resource.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# pragma GCC system_header
1616
#endif
1717

18+
#if _LIBCPP_STD_VER >= 17
19+
1820
_LIBCPP_BEGIN_NAMESPACE_STD
1921

2022
namespace pmr {
@@ -24,4 +26,6 @@ class _LIBCPP_AVAILABILITY_PMR _LIBCPP_TEMPLATE_VIS polymorphic_allocator;
2426

2527
_LIBCPP_END_NAMESPACE_STD
2628

29+
#endif // _LIBCPP_STD_VER >= 17
30+
2731
#endif // _LIBCPP___FWD_MEMORY_RESOURCE_H

libcxx/include/__memory/allocator_arg_t.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ constexpr allocator_arg_t allocator_arg = allocator_arg_t();
3939

4040
template <class _Tp, class _Alloc, class... _Args>
4141
struct __uses_alloc_ctor_imp {
42-
typedef _LIBCPP_NODEBUG __remove_cvref_t<_Alloc> _RawAlloc;
43-
static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
44-
static const bool __ic = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
45-
static const int value = __ua ? 2 - __ic : 0;
42+
using _RawAlloc _LIBCPP_NODEBUG = __remove_cvref_t<_Alloc>;
43+
static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
44+
static const bool __ic = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
45+
static const int value = __ua ? 2 - __ic : 0;
4646
};
4747

4848
template <class _Tp, class _Alloc, class... _Args>

libcxx/include/__memory/allocator_destructor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2020

2121
template <class _Alloc>
2222
class __allocator_destructor {
23-
typedef _LIBCPP_NODEBUG allocator_traits<_Alloc> __alloc_traits;
23+
using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<_Alloc>;
2424

2525
public:
26-
typedef _LIBCPP_NODEBUG typename __alloc_traits::pointer pointer;
27-
typedef _LIBCPP_NODEBUG typename __alloc_traits::size_type size_type;
26+
using pointer _LIBCPP_NODEBUG = typename __alloc_traits::pointer;
27+
using size_type _LIBCPP_NODEBUG = typename __alloc_traits::size_type;
2828

2929
private:
3030
_Alloc& __alloc_;

libcxx/include/__memory/pointer_traits.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ struct __pointer_traits_element_type {};
5050

5151
template <class _Ptr>
5252
struct __pointer_traits_element_type<_Ptr, true> {
53-
typedef _LIBCPP_NODEBUG typename _Ptr::element_type type;
53+
using type _LIBCPP_NODEBUG = typename _Ptr::element_type;
5454
};
5555

5656
template <template <class, class...> class _Sp, class _Tp, class... _Args>
5757
struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true> {
58-
typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::element_type type;
58+
using type _LIBCPP_NODEBUG = typename _Sp<_Tp, _Args...>::element_type;
5959
};
6060

6161
template <template <class, class...> class _Sp, class _Tp, class... _Args>
6262
struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false> {
63-
typedef _LIBCPP_NODEBUG _Tp type;
63+
using type _LIBCPP_NODEBUG = _Tp;
6464
};
6565

6666
template <class _Tp, class = void>
@@ -71,12 +71,12 @@ struct __has_difference_type<_Tp, __void_t<typename _Tp::difference_type> > : tr
7171

7272
template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
7373
struct __pointer_traits_difference_type {
74-
typedef _LIBCPP_NODEBUG ptrdiff_t type;
74+
using type _LIBCPP_NODEBUG = ptrdiff_t;
7575
};
7676

7777
template <class _Ptr>
7878
struct __pointer_traits_difference_type<_Ptr, true> {
79-
typedef _LIBCPP_NODEBUG typename _Ptr::difference_type type;
79+
using type _LIBCPP_NODEBUG = typename _Ptr::difference_type;
8080
};
8181

8282
template <class _Tp, class _Up>
@@ -96,18 +96,18 @@ struct __has_rebind {
9696
template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
9797
struct __pointer_traits_rebind {
9898
#ifndef _LIBCPP_CXX03_LANG
99-
typedef _LIBCPP_NODEBUG typename _Tp::template rebind<_Up> type;
99+
using type _LIBCPP_NODEBUG = typename _Tp::template rebind<_Up>;
100100
#else
101-
typedef _LIBCPP_NODEBUG typename _Tp::template rebind<_Up>::other type;
101+
using type _LIBCPP_NODEBUG = typename _Tp::template rebind<_Up>::other;
102102
#endif
103103
};
104104

105105
template <template <class, class...> class _Sp, class _Tp, class... _Args, class _Up>
106106
struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true> {
107107
#ifndef _LIBCPP_CXX03_LANG
108-
typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
108+
using type _LIBCPP_NODEBUG = typename _Sp<_Tp, _Args...>::template rebind<_Up>;
109109
#else
110-
typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
110+
using type _LIBCPP_NODEBUG = typename _Sp<_Tp, _Args...>::template rebind<_Up>::other;
111111
#endif
112112
};
113113

libcxx/include/__memory/unique_ptr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr {
161161
private:
162162
_LIBCPP_COMPRESSED_PAIR(pointer, __ptr_, deleter_type, __deleter_);
163163

164-
typedef _LIBCPP_NODEBUG __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
164+
using _DeleterSFINAE _LIBCPP_NODEBUG = __unique_ptr_deleter_sfinae<_Dp>;
165165

166166
template <bool _Dummy>
167167
using _LValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;

libcxx/include/__ranges/join_view.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,8 @@ template <class _JoinViewIterator>
377377
__has_random_access_iterator_category<typename _JoinViewIterator::_Outer>::value &&
378378
__has_random_access_iterator_category<typename _JoinViewIterator::_Inner>::value)
379379
struct __segmented_iterator_traits<_JoinViewIterator> {
380-
using __segment_iterator =
381-
_LIBCPP_NODEBUG __iterator_with_data<typename _JoinViewIterator::_Outer, typename _JoinViewIterator::_Parent*>;
380+
using __segment_iterator _LIBCPP_NODEBUG =
381+
__iterator_with_data<typename _JoinViewIterator::_Outer, typename _JoinViewIterator::_Parent*>;
382382
using __local_iterator = typename _JoinViewIterator::_Inner;
383383

384384
// TODO: Would it make sense to enable the optimization for other iterator types?

0 commit comments

Comments
 (0)