[llvm-branch-commits] [libcxx] [libc++][format][2/7] Optimizes c-string arguments. (PR #101805)
Louis Dionne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Aug 13 08:59:25 PDT 2024
================
@@ -64,32 +64,14 @@ struct _LIBCPP_TEMPLATE_VIS formatter<const _CharT*, _CharT> : public __formatte
template <class _FormatContext>
_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _CharT* __str, _FormatContext& __ctx) const {
_LIBCPP_ASSERT_INTERNAL(__str, "The basic_format_arg constructor should have prevented an invalid pointer.");
-
- __format_spec::__parsed_specifications<_CharT> __specs = _Base::__parser_.__get_parsed_std_specifications(__ctx);
-# if _LIBCPP_STD_VER >= 23
- if (_Base::__parser_.__type_ == __format_spec::__type::__debug)
- return __formatter::__format_escaped_string(basic_string_view<_CharT>{__str}, __ctx.out(), __specs);
-# endif
-
- // When using a center or right alignment and the width option the length
- // of __str must be known to add the padding upfront. This case is handled
- // by the base class by converting the argument to a basic_string_view.
+ // Converting the input to a basic_string_view means the data is looped over twice;
+ // - once to determine the lenght, and
----------------
ldionne wrote:
```suggestion
// - once to determine the length, and
```
https://github.com/llvm/llvm-project/pull/101805
More information about the llvm-branch-commits
mailing list