aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h')
-rw-r--r--contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h79
1 files changed, 40 insertions, 39 deletions
diff --git a/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h b/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h
index ea5dfdf30511..e38729db965c 100644
--- a/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h
+++ b/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h
@@ -82,8 +82,7 @@ __parse_arg_id(_Iterator __begin, _Iterator __end, _ParseContext& __ctx) {
}
template <class _Context>
-_LIBCPP_HIDE_FROM_ABI constexpr uint32_t
-__substitute_arg_id(basic_format_arg<_Context> __format_arg) {
+_LIBCPP_HIDE_FROM_ABI constexpr uint32_t __substitute_arg_id(basic_format_arg<_Context> __format_arg) {
// [format.string.std]/8
// If the corresponding formatting argument is not of integral type...
// This wording allows char and bool too. LWG-3720 changes the wording to
@@ -240,22 +239,22 @@ inline constexpr uint32_t __type_mask_integer =
__create_type_mask(__type::__hexadecimal_upper_case);
struct __std {
- __alignment __alignment_ : 3;
- __sign __sign_ : 2;
- bool __alternate_form_ : 1;
+ __alignment __alignment_ : 3;
+ __sign __sign_ : 2;
+ bool __alternate_form_ : 1;
bool __locale_specific_form_ : 1;
__type __type_;
};
struct __chrono {
- __alignment __alignment_ : 3;
+ __alignment __alignment_ : 3;
bool __locale_specific_form_ : 1;
bool __hour_ : 1;
- bool __weekday_name_ : 1;
+ bool __weekday_name_ : 1;
bool __weekday_ : 1;
bool __day_of_year_ : 1;
bool __week_of_year_ : 1;
- bool __month_name_ : 1;
+ bool __month_name_ : 1;
};
// The fill UCS scalar value.
@@ -495,8 +494,7 @@ public:
}
/// \returns the `__parsed_specifications` with the resolved dynamic sizes..
- _LIBCPP_HIDE_FROM_ABI
- __parsed_specifications<_CharT> __get_parsed_std_specifications(auto& __ctx) const {
+ _LIBCPP_HIDE_FROM_ABI __parsed_specifications<_CharT> __get_parsed_std_specifications(auto& __ctx) const {
return __parsed_specifications<_CharT>{
.__std_ = __std{.__alignment_ = __alignment_,
.__sign_ = __sign_,
@@ -524,9 +522,9 @@ public:
.__fill_{__fill_}};
}
- __alignment __alignment_ : 3 {__alignment::__default};
- __sign __sign_ : 2 {__sign::__default};
- bool __alternate_form_ : 1 {false};
+ __alignment __alignment_ : 3 {__alignment::__default};
+ __sign __sign_ : 2 {__sign::__default};
+ bool __alternate_form_ : 1 {false};
bool __locale_specific_form_ : 1 {false};
bool __clear_brackets_ : 1 {false};
__type __type_{__type::__default};
@@ -547,7 +545,7 @@ public:
uint8_t __reserved_1_ : 6 {0};
// These two flags are only used internally and not part of the
// __parsed_specifications. Therefore put them at the end.
- bool __width_as_arg_ : 1 {false};
+ bool __width_as_arg_ : 1 {false};
bool __precision_as_arg_ : 1 {false};
/// The requested width, either the value or the arg-id.
@@ -593,9 +591,10 @@ private:
|| (same_as<_CharT, wchar_t> && sizeof(wchar_t) == 2)
# endif
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__begin != __end,
- "when called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __begin != __end,
+ "when called with an empty input the function will cause "
+ "undefined behavior by evaluating data not in the input");
__unicode::__code_point_view<_CharT> __view{__begin, __end};
__unicode::__consume_result __consumed = __view.__consume();
if (__consumed.__status != __unicode::__consume_result::__ok)
@@ -625,9 +624,10 @@ private:
template <contiguous_iterator _Iterator>
requires(same_as<_CharT, wchar_t> && sizeof(wchar_t) == 4)
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__begin != __end,
- "when called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __begin != __end,
+ "when called with an empty input the function will cause "
+ "undefined behavior by evaluating data not in the input");
if (__begin + 1 != __end && __parse_alignment(*(__begin + 1))) {
if (!__unicode::__is_scalar_value(*__begin))
std::__throw_format_error("The fill option contains an invalid value");
@@ -652,9 +652,10 @@ private:
// range-fill and tuple-fill are identical
template <contiguous_iterator _Iterator>
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__begin != __end,
- "when called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __begin != __end,
+ "when called with an empty input the function will cause "
+ "undefined behavior by evaluating data not in the input");
if (__begin + 1 != __end) {
if (__parse_alignment(*(__begin + 1))) {
__validate_fill_character(*__begin, __use_range_fill);
@@ -721,9 +722,9 @@ private:
if (*__begin == _CharT('{')) {
__format::__parse_number_result __r = __format_spec::__parse_arg_id(++__begin, __end, __ctx);
- __width_as_arg_ = true;
- __width_ = __r.__value;
- __begin = __r.__last;
+ __width_as_arg_ = true;
+ __width_ = __r.__value;
+ __begin = __r.__last;
return true;
}
@@ -731,9 +732,11 @@ private:
return false;
__format::__parse_number_result __r = __format::__parse_number(__begin, __end);
- __width_ = __r.__value;
- _LIBCPP_ASSERT_UNCATEGORIZED(__width_ != 0, "A zero value isn't allowed and should be impossible, "
- "due to validations in this function");
+ __width_ = __r.__value;
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __width_ != 0,
+ "A zero value isn't allowed and should be impossible, "
+ "due to validations in this function");
__begin = __r.__last;
return true;
}
@@ -749,9 +752,9 @@ private:
if (*__begin == _CharT('{')) {
__format::__parse_number_result __arg_id = __format_spec::__parse_arg_id(++__begin, __end, __ctx);
- __precision_as_arg_ = true;
- __precision_ = __arg_id.__value;
- __begin = __arg_id.__last;
+ __precision_as_arg_ = true;
+ __precision_ = __arg_id.__value;
+ __begin = __arg_id.__last;
return true;
}
@@ -759,9 +762,9 @@ private:
std::__throw_format_error("The precision option does not contain a value or an argument index");
__format::__parse_number_result __r = __format::__parse_number(__begin, __end);
- __precision_ = __r.__value;
- __precision_as_arg_ = false;
- __begin = __r.__last;
+ __precision_ = __r.__value;
+ __precision_as_arg_ = false;
+ __begin = __r.__last;
return true;
}
@@ -858,16 +861,14 @@ private:
++__begin;
}
- _LIBCPP_HIDE_FROM_ABI
- int32_t __get_width(auto& __ctx) const {
+ _LIBCPP_HIDE_FROM_ABI int32_t __get_width(auto& __ctx) const {
if (!__width_as_arg_)
return __width_;
return __format_spec::__substitute_arg_id(__ctx.arg(__width_));
}
- _LIBCPP_HIDE_FROM_ABI
- int32_t __get_precision(auto& __ctx) const {
+ _LIBCPP_HIDE_FROM_ABI int32_t __get_precision(auto& __ctx) const {
if (!__precision_as_arg_)
return __precision_;