[libcxx-commits] [libcxx] 0e50216 - [libc++][format][nfc] Remove dead code.
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 16 07:04:06 PST 2021
Author: Mark de Wever
Date: 2021-11-16T16:02:26+01:00
New Revision: 0e50216f22adef2d69cc35ae0e246a42c9a7458c
URL: https://github.com/llvm/llvm-project/commit/0e50216f22adef2d69cc35ae0e246a42c9a7458c
DIFF: https://github.com/llvm/llvm-project/commit/0e50216f22adef2d69cc35ae0e246a42c9a7458c.diff
LOG: [libc++][format][nfc] Remove dead code.
This was an early part of the prototype. This has never been shipped
enabled and the final version of this code looks completely different.
Added:
Modified:
libcxx/include/format
Removed:
################################################################################
diff --git a/libcxx/include/format b/libcxx/include/format
index ce16857665cd..53ecb5a43d43 100644
--- a/libcxx/include/format
+++ b/libcxx/include/format
@@ -350,78 +350,6 @@ make_wformat_args(const _Args&... __args) {
namespace __format {
-template <class _Tp, class _CharT>
-requires(is_arithmetic_v<_Tp> &&
- !same_as<_Tp, bool>) struct _LIBCPP_HIDE_FROM_ABI
- __formatter_arithmetic {
- _LIBCPP_HIDE_FROM_ABI
- auto parse(auto& __parse_ctx) -> decltype(__parse_ctx.begin()) {
- // TODO FMT Implement
- return __parse_ctx.begin();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- auto format(_Tp __value, auto& __ctx) -> decltype(__ctx.out()) {
- return __handle_format(__value, __ctx);
- }
-
-private:
- template <class _Uv>
- _LIBCPP_HIDDEN static string
- __convert(_Uv __value) requires(same_as<_CharT, char>) {
- return _VSTD::to_string(__value);
- }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- template <class _Uv>
- _LIBCPP_HIDDEN static wstring
- __convert(_Uv __value) requires(same_as<_CharT, wchar_t>) {
- return _VSTD::to_wstring(__value);
- }
-#endif
-
- template <class _Uv>
- _LIBCPP_HIDDEN auto __handle_format(_Uv __value, auto& __ctx)
- -> decltype(__ctx.out())
- {
- // TODO FMT Implement using formatting arguments
- // TODO FMT Improve PoC since using std::to_string is inefficient.
- // Note the code doesn't use std::string::iterator since the unit tests
- // test with debug iterators and they fail with strings created from
- // std::to_string.
- auto __str = __convert(__value);
- auto __out_it = __ctx.out();
- for (size_t __i = 0, __e = __str.size(); __i != __e; ++__i)
- *__out_it++ = __str[__i];
- return __out_it;
- }
-};
-} // namespace __format
-
-// These specializations are helper stubs and not proper formatters.
-// TODO FMT Implement the proper formatter specializations.
-
-// Floating point types.
-// TODO FMT There are no replacements for the floating point stubs due to not
-// having floating point support in std::to_chars yet. These stubs aren't
-// removed since they are useful for developing the real versions.
-// Ultimately the stubs should be implemented properly and this code can be
-// removed.
-#if 0
-template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<float, _CharT>
- : public __format::__formatter_arithmetic<float, _CharT> {};
-template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT
- formatter<double, _CharT>
- : public __format::__formatter_arithmetic<double, _CharT> {};
-template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT
- formatter<long double, _CharT>
- : public __format::__formatter_arithmetic<long double, _CharT> {};
-#endif
-
-namespace __format {
-
template <class _CharT, class _ParseCtx, class _Ctx>
_LIBCPP_HIDE_FROM_ABI const _CharT*
__handle_replacement_field(const _CharT* __begin, const _CharT* __end,
More information about the libcxx-commits
mailing list