Skip to content

Commit

Permalink
[libc++][format] Adhere to clang-tidy style.
Browse files Browse the repository at this point in the history
D126971 broke the CI due to recent changes in the clang-tidy settings.
This fixes them.
  • Loading branch information
mordante committed Jul 21, 2022
1 parent ccbab2c commit 4db55a4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions libcxx/include/__format/formatter_output.h
Expand Up @@ -275,9 +275,9 @@ _LIBCPP_HIDE_FROM_ABI auto __write_string_no_precision(
}

template <class _CharT>
_LIBCPP_HIDE_FROM_ABI int __truncate(basic_string_view<_CharT>& __str, int __precision_) {
_LIBCPP_HIDE_FROM_ABI int __truncate(basic_string_view<_CharT>& __str, int __precision) {
__format_spec::__column_width_result<_CharT> __result =
__format_spec::__estimate_column_width(__str, __precision_, __format_spec::__column_width_rounding::__down);
__format_spec::__estimate_column_width(__str, __precision, __format_spec::__column_width_rounding::__down);
__str = basic_string_view<_CharT>{__str.begin(), __result.__last_};
return __result.__width_;
}
Expand Down
32 changes: 16 additions & 16 deletions libcxx/include/__format/unicode.h
Expand Up @@ -179,10 +179,10 @@ class __code_point_view<wchar_t> {
# endif

_LIBCPP_HIDE_FROM_ABI constexpr bool __at_extended_grapheme_cluster_break(
bool& __RI_break_allowed,
bool& __ri_break_allowed,
bool __has_extened_pictographic,
__extended_grapheme_custer_property_boundary::__property __prev,
__extended_grapheme_custer_property_boundary::__property __next_) {
__extended_grapheme_custer_property_boundary::__property __next) {
using __extended_grapheme_custer_property_boundary::__property;

__has_extened_pictographic |= __prev == __property::__Extended_Pictographic;
Expand All @@ -195,34 +195,34 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __at_extended_grapheme_cluster_break(
_LIBCPP_ASSERT(__prev != __property::__eot, "should be handled by our caller"); // GB2

// *** Do not break between a CR and LF. Otherwise, break before and after controls. ***
if (__prev == __property::__CR && __next_ == __property::__LF) // GB3
if (__prev == __property::__CR && __next == __property::__LF) // GB3
return false;

if (__prev == __property::__Control || __prev == __property::__CR || __prev == __property::__LF) // GB4
return true;

if (__next_ == __property::__Control || __next_ == __property::__CR || __next_ == __property::__LF) // GB5
if (__next == __property::__Control || __next == __property::__CR || __next == __property::__LF) // GB5
return true;

// *** Do not break Hangul syllable sequences. ***
if (__prev == __property::__L &&
(__next_ == __property::__L || __next_ == __property::__V || __next_ == __property::__LV ||
__next_ == __property::__LVT)) // GB6
(__next == __property::__L || __next == __property::__V || __next == __property::__LV ||
__next == __property::__LVT)) // GB6
return false;

if ((__prev == __property::__LV || __prev == __property::__V) &&
(__next_ == __property::__V || __next_ == __property::__T)) // GB7
(__next == __property::__V || __next == __property::__T)) // GB7
return false;

if ((__prev == __property::__LVT || __prev == __property::__T) && __next_ == __property::__T) // GB8
if ((__prev == __property::__LVT || __prev == __property::__T) && __next == __property::__T) // GB8
return false;

// *** Do not break before extending characters or ZWJ. ***
if (__next_ == __property::__Extend || __next_ == __property::__ZWJ)
if (__next == __property::__Extend || __next == __property::__ZWJ)
return false; // GB9

// *** Do not break before SpacingMarks, or after Prepend characters. ***
if (__next_ == __property::__SpacingMark) // GB9a
if (__next == __property::__SpacingMark) // GB9a
return false;

if (__prev == __property::__Prepend) // GB9b
Expand All @@ -241,17 +241,17 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __at_extended_grapheme_cluster_break(
// So the only case left to test is
// - \p{Extended_Pictographic}' x ZWJ x \p{Extended_Pictographic}
// where \p{Extended_Pictographic}' is stored in __has_extened_pictographic
if (__has_extened_pictographic && __prev == __property::__ZWJ && __next_ == __property::__Extended_Pictographic)
if (__has_extened_pictographic && __prev == __property::__ZWJ && __next == __property::__Extended_Pictographic)
return false;

// *** Do not break within emoji flag sequences ***

// That is, do not break between regional indicator (RI) symbols if there
// is an odd number of RI characters before the break point.

if (__prev == __property::__Regional_Indicator && __next_ == __property::__Regional_Indicator) { // GB12 + GB13
__RI_break_allowed = !__RI_break_allowed;
if (__RI_break_allowed)
if (__prev == __property::__Regional_Indicator && __next == __property::__Regional_Indicator) { // GB12 + GB13
__ri_break_allowed = !__ri_break_allowed;
if (__ri_break_allowed)
return true;

return false;
Expand Down Expand Up @@ -307,7 +307,7 @@ class __extended_grapheme_cluster_view {
__extended_grapheme_custer_property_boundary::__property __next_prop_;

_LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __get_break() {
bool __RI_break_allowed = true;
bool __ri_break_allowed = true;
bool __has_extened_pictographic = false;
while (true) {
const _CharT* __result = __code_point_view_.__position();
Expand All @@ -322,7 +322,7 @@ class __extended_grapheme_cluster_view {
__has_extened_pictographic |=
__prev == __extended_grapheme_custer_property_boundary::__property::__Extended_Pictographic;

if (__at_extended_grapheme_cluster_break(__RI_break_allowed, __has_extened_pictographic, __prev, __next_prop_))
if (__at_extended_grapheme_cluster_break(__ri_break_allowed, __has_extened_pictographic, __prev, __next_prop_))
return __result;
}
}
Expand Down

0 comments on commit 4db55a4

Please sign in to comment.