[libcxx-commits] [libcxx] c1905b1 - [NFC][libc++][format] Uses qualified calls.
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Dec 14 13:14:25 PST 2022
Author: Mark de Wever
Date: 2022-12-14T22:14:19+01:00
New Revision: c1905b1c413c0c1cc7ab715c8b231576ea8c9561
URL: https://github.com/llvm/llvm-project/commit/c1905b1c413c0c1cc7ab715c8b231576ea8c9561
DIFF: https://github.com/llvm/llvm-project/commit/c1905b1c413c0c1cc7ab715c8b231576ea8c9561.diff
LOG: [NFC][libc++][format] Uses qualified calls.
Changes all unqualified calls to __throw_format_error to use a qualified
call.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D140038
Added:
Modified:
libcxx/include/__format/format_functions.h
libcxx/include/__format/format_parse_context.h
libcxx/include/__format/format_string.h
libcxx/include/__format/parser_std_format_spec.h
Removed:
################################################################################
diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 8c8b54e80818a..7e3afd91bdf77 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -101,7 +101,7 @@ class _LIBCPP_TEMPLATE_VIS __compile_time_handle {
// Before calling __parse the proper handler needs to be set with __enable.
// The default handler isn't a core constant expression.
_LIBCPP_HIDE_FROM_ABI constexpr __compile_time_handle()
- : __parse_([](basic_format_parse_context<_CharT>&) { __throw_format_error("Not a handle"); }) {}
+ : __parse_([](basic_format_parse_context<_CharT>&) { std::__throw_format_error("Not a handle"); }) {}
private:
void (*__parse_)(basic_format_parse_context<_CharT>&);
@@ -128,13 +128,13 @@ struct _LIBCPP_TEMPLATE_VIS __compile_time_basic_format_context {
_LIBCPP_HIDE_FROM_ABI constexpr __arg_t arg(size_t __id) const {
if (__id >= __size_)
- __throw_format_error("Argument index out of bounds");
+ std::__throw_format_error("Argument index out of bounds");
return __args_[__id];
}
_LIBCPP_HIDE_FROM_ABI constexpr const __compile_time_handle<_CharT>& __handle(size_t __id) const {
if (__id >= __size_)
- __throw_format_error("Argument index out of bounds");
+ std::__throw_format_error("Argument index out of bounds");
return __handles_[__id];
}
@@ -159,7 +159,7 @@ constexpr void __compile_time_validate_integral(__arg_t __type) {
return;
default:
- __throw_format_error("Argument isn't an integral type");
+ std::__throw_format_error("Argument isn't an integral type");
}
}
@@ -191,7 +191,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_forma
__arg_t __type) {
switch (__type) {
case __arg_t::__none:
- __throw_format_error("Invalid argument");
+ std::__throw_format_error("Invalid argument");
case __arg_t::__boolean:
return __format::__compile_time_validate_argument<_CharT, bool>(__parse_ctx, __ctx);
case __arg_t::__char_type:
@@ -204,7 +204,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_forma
# ifndef _LIBCPP_HAS_NO_INT128
return __format::__compile_time_validate_argument<_CharT, __int128_t>(__parse_ctx, __ctx);
# else
- __throw_format_error("Invalid argument");
+ std::__throw_format_error("Invalid argument");
# endif
return;
case __arg_t::__unsigned:
@@ -215,7 +215,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_forma
# ifndef _LIBCPP_HAS_NO_INT128
return __format::__compile_time_validate_argument<_CharT, __uint128_t>(__parse_ctx, __ctx);
# else
- __throw_format_error("Invalid argument");
+ std::__throw_format_error("Invalid argument");
# endif
return;
case __arg_t::__float:
@@ -231,9 +231,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_forma
case __arg_t::__ptr:
return __format::__compile_time_validate_argument<_CharT, const void*>(__parse_ctx, __ctx);
case __arg_t::__handle:
- __throw_format_error("Handle should use __compile_time_validate_handle_argument");
+ std::__throw_format_error("Handle should use __compile_time_validate_handle_argument");
}
- __throw_format_error("Invalid argument");
+ std::__throw_format_error("Invalid argument");
}
template <class _CharT, class _ParseCtx, class _Ctx>
@@ -253,8 +253,7 @@ __handle_replacement_field(const _CharT* __begin, const _CharT* __end,
__parse_ctx.advance_to(__r.__ptr);
break;
default:
- __throw_format_error(
- "The replacement field arg-id should terminate at a ':' or '}'");
+ std::__throw_format_error("The replacement field arg-id should terminate at a ':' or '}'");
}
if constexpr (same_as<_Ctx, __compile_time_basic_format_context<_CharT>>) {
@@ -267,7 +266,7 @@ __handle_replacement_field(const _CharT* __begin, const _CharT* __end,
_VSTD::__visit_format_arg(
[&](auto __arg) {
if constexpr (same_as<decltype(__arg), monostate>)
- __throw_format_error("Argument index out of bounds");
+ std::__throw_format_error("Argument index out of bounds");
else if constexpr (same_as<decltype(__arg), typename basic_format_arg<_Ctx>::handle>)
__arg.format(__parse_ctx, __ctx);
else {
@@ -281,7 +280,7 @@ __handle_replacement_field(const _CharT* __begin, const _CharT* __end,
__begin = __parse_ctx.begin();
if (__begin == __end || *__begin != _CharT('}'))
- __throw_format_error("The replacement field misses a terminating '}'");
+ std::__throw_format_error("The replacement field misses a terminating '}'");
return ++__begin;
}
@@ -300,7 +299,7 @@ __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) {
case _CharT('{'):
++__begin;
if (__begin == __end)
- __throw_format_error("The format string terminates at a '{'");
+ std::__throw_format_error("The format string terminates at a '{'");
if (*__begin != _CharT('{')) [[likely]] {
__ctx.advance_to(_VSTD::move(__out_it));
@@ -318,8 +317,7 @@ __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) {
case _CharT('}'):
++__begin;
if (__begin == __end || *__begin != _CharT('}'))
- __throw_format_error(
- "The format string contains an invalid escape sequence");
+ std::__throw_format_error("The format string contains an invalid escape sequence");
break;
}
diff --git a/libcxx/include/__format/format_parse_context.h b/libcxx/include/__format/format_parse_context.h
index 4bcfda1138c9a..30e3a7dfdaf39 100644
--- a/libcxx/include/__format/format_parse_context.h
+++ b/libcxx/include/__format/format_parse_context.h
@@ -54,8 +54,7 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_parse_contex
_LIBCPP_HIDE_FROM_ABI constexpr size_t next_arg_id() {
if (__indexing_ == __manual)
- __throw_format_error("Using automatic argument numbering in manual "
- "argument numbering mode");
+ std::__throw_format_error("Using automatic argument numbering in manual argument numbering mode");
if (__indexing_ == __unknown)
__indexing_ = __automatic;
@@ -63,8 +62,7 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_parse_contex
}
_LIBCPP_HIDE_FROM_ABI constexpr void check_arg_id(size_t __id) {
if (__indexing_ == __automatic)
- __throw_format_error("Using manual argument numbering in automatic "
- "argument numbering mode");
+ std::__throw_format_error("Using manual argument numbering in automatic argument numbering mode");
if (__indexing_ == __unknown)
__indexing_ = __manual;
@@ -77,7 +75,7 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_parse_contex
// Note: the Throws clause [format.parse.ctx]/10 doesn't specify the
// behavior when id >= num_args_.
if (is_constant_evaluated() && __id >= __num_args_)
- __throw_format_error("Argument index outside the valid range");
+ std::__throw_format_error("Argument index outside the valid range");
}
private:
diff --git a/libcxx/include/__format/format_string.h b/libcxx/include/__format/format_string.h
index 6033180d97c10..dc4e8dfd87208 100644
--- a/libcxx/include/__format/format_string.h
+++ b/libcxx/include/__format/format_string.h
@@ -120,7 +120,7 @@ __parse_number(const _CharT* __begin, const _CharT* __end_input) {
if (__v > __number_max ||
(__begin != __end_input && *__begin >= _CharT('0') &&
*__begin <= _CharT('9')))
- __throw_format_error("The numeric value of the format-spec is too large");
+ std::__throw_format_error("The numeric value of the format-spec is too large");
__value = __v;
}
@@ -149,8 +149,7 @@ __parse_arg_id(const _CharT* __begin, const _CharT* __end, auto& __parse_ctx) {
return __detail::__parse_automatic(__begin, __end, __parse_ctx);
}
if (*__begin < _CharT('0') || *__begin > _CharT('9'))
- __throw_format_error(
- "The arg-id of the format-spec starts with an invalid character");
+ std::__throw_format_error("The arg-id of the format-spec starts with an invalid character");
return __detail::__parse_manual(__begin, __end, __parse_ctx);
}
diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h
index 90c0cd184ce1f..759ace2111d65 100644
--- a/libcxx/include/__format/parser_std_format_spec.h
+++ b/libcxx/include/__format/parser_std_format_spec.h
@@ -52,12 +52,12 @@ __parse_arg_id(const _CharT* __begin, const _CharT* __end, auto& __parse_ctx) {
// This function is a wrapper to call the real parser. But it does the
// validation for the pre-conditions and post-conditions.
if (__begin == __end)
- __throw_format_error("End of input while parsing format-spec arg-id");
+ std::__throw_format_error("End of input while parsing format-spec arg-id");
__format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __parse_ctx);
if (__r.__ptr == __end || *__r.__ptr != _CharT('}'))
- __throw_format_error("Invalid arg-id");
+ std::__throw_format_error("Invalid arg-id");
++__r.__ptr;
return __r;
@@ -80,22 +80,19 @@ __substitute_arg_id(basic_format_arg<_Context> __format_arg) {
if constexpr (integral<_Type>) {
if constexpr (signed_integral<_Type>) {
if (__arg < 0)
- __throw_format_error("A format-spec arg-id replacement shouldn't "
- "have a negative value");
+ std::__throw_format_error("A format-spec arg-id replacement shouldn't have a negative value");
}
using _CT = common_type_t<_Type, decltype(__format::__number_max)>;
if (static_cast<_CT>(__arg) >
static_cast<_CT>(__format::__number_max))
- __throw_format_error("A format-spec arg-id replacement exceeds "
- "the maximum supported value");
+ std::__throw_format_error("A format-spec arg-id replacement exceeds the maximum supported value");
return __arg;
} else if constexpr (same_as<_Type, monostate>)
- __throw_format_error("Argument index out of bounds");
+ std::__throw_format_error("Argument index out of bounds");
else
- __throw_format_error("A format-spec arg-id replacement argument "
- "isn't an integral type");
+ std::__throw_format_error("A format-spec arg-id replacement argument isn't an integral type");
},
__format_arg);
}
@@ -287,7 +284,7 @@ class _LIBCPP_TEMPLATE_VIS __parser {
// parsing. In that case that parser should do the end of format string
// validation.
if (__begin != __end && *__begin != _CharT('}'))
- __throw_format_error("The format-spec should consume the input or end with a '}'");
+ std::__throw_format_error("The format-spec should consume the input or end with a '}'");
}
return __begin;
@@ -373,7 +370,7 @@ class _LIBCPP_TEMPLATE_VIS __parser {
if (__begin + 1 != __end) {
if (__parse_alignment(*(__begin + 1))) {
if (*__begin == _CharT('{') || *__begin == _CharT('}'))
- __throw_format_error("The format-spec fill field contains an invalid character");
+ std::__throw_format_error("The format-spec fill field contains an invalid character");
__fill_ = *__begin;
__begin += 2;
@@ -427,7 +424,7 @@ class _LIBCPP_TEMPLATE_VIS __parser {
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_width(const _CharT*& __begin, const _CharT* __end, auto& __parse_ctx) {
if (*__begin == _CharT('0'))
- __throw_format_error("A format-spec width field shouldn't have a leading zero");
+ std::__throw_format_error("A format-spec width field shouldn't have a leading zero");
if (*__begin == _CharT('{')) {
__format::__parse_number_result __r = __format_spec::__parse_arg_id(++__begin, __end, __parse_ctx);
@@ -455,7 +452,7 @@ class _LIBCPP_TEMPLATE_VIS __parser {
++__begin;
if (__begin == __end)
- __throw_format_error("End of input while parsing format-spec precision");
+ std::__throw_format_error("End of input while parsing format-spec precision");
if (*__begin == _CharT('{')) {
__format::__parse_number_result __arg_id = __format_spec::__parse_arg_id(++__begin, __end, __parse_ctx);
@@ -466,7 +463,7 @@ class _LIBCPP_TEMPLATE_VIS __parser {
}
if (*__begin < _CharT('0') || *__begin > _CharT('9'))
- __throw_format_error("The format-spec precision field doesn't contain a value or arg-id");
+ std::__throw_format_error("The format-spec precision field doesn't contain a value or arg-id");
__format::__parse_number_result __r = __format::__parse_number(__begin, __end);
__precision_ = __r.__value;
More information about the libcxx-commits
mailing list