[libcxx-commits] [libcxx] 10c4eec - [NFC][libc++][format] Improves naming.
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 1 12:05:36 PDT 2022
Author: Mark de Wever
Date: 2022-06-01T21:05:31+02:00
New Revision: 10c4eec2785a68880c287d36c262d5be3a72a128
URL: https://github.com/llvm/llvm-project/commit/10c4eec2785a68880c287d36c262d5be3a72a128
DIFF: https://github.com/llvm/llvm-project/commit/10c4eec2785a68880c287d36c262d5be3a72a128.diff
LOG: [NFC][libc++][format] Improves naming.
Based on review comments in D110499.
Depends on D110499
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D125610
Added:
Modified:
libcxx/include/__format/buffer.h
Removed:
################################################################################
diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h
index 14926e32c6671..55cde0044e175 100644
--- a/libcxx/include/__format/buffer.h
+++ b/libcxx/include/__format/buffer.h
@@ -101,11 +101,11 @@ template <__formatter::__char_type _CharT>
class _LIBCPP_TEMPLATE_VIS __internal_storage {
public:
_LIBCPP_HIDE_FROM_ABI _CharT* begin() { return __buffer_; }
- _LIBCPP_HIDE_FROM_ABI size_t capacity() { return __buffer_size_; }
+
+ static constexpr size_t __buffer_size = 256 / sizeof(_CharT);
private:
- static constexpr size_t __buffer_size_ = 256 / sizeof(_CharT);
- _CharT __buffer_[__buffer_size_];
+ _CharT __buffer_[__buffer_size];
};
/// A storage writing directly to the storage.
@@ -223,10 +223,9 @@ requires(output_iterator<_OutIt, const _CharT&>) class _LIBCPP_TEMPLATE_VIS
__direct_storage<_CharT>, __internal_storage<_CharT>>;
public:
- _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it) requires(
- same_as<_Storage, __internal_storage<_CharT>>)
- : __output_(__storage_.begin(), __storage_.capacity(), this),
- __writer_(_VSTD::move(__out_it)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it)
+ requires(same_as<_Storage, __internal_storage<_CharT>>)
+ : __output_(__storage_.begin(), __storage_.__buffer_size, this), __writer_(_VSTD::move(__out_it)) {}
_LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it) requires(
same_as<_Storage, __direct_storage<_CharT>>)
@@ -270,7 +269,7 @@ class _LIBCPP_TEMPLATE_VIS __formatted_size_buffer {
private:
__internal_storage<_CharT> __storage_;
- __output_buffer<_CharT> __output_{__storage_.begin(), __storage_.capacity(), this};
+ __output_buffer<_CharT> __output_{__storage_.begin(), __storage_.__buffer_size, this};
size_t __size_{0};
};
@@ -292,7 +291,7 @@ struct _LIBCPP_TEMPLATE_VIS __format_to_n_buffer_base {
protected:
__internal_storage<_CharT> __storage_;
- __output_buffer<_CharT> __output_{__storage_.begin(), __storage_.capacity(), this};
+ __output_buffer<_CharT> __output_{__storage_.begin(), __storage_.__buffer_size, this};
typename __writer_selector<_OutIt, _CharT>::type __writer_;
_Size __n_;
@@ -314,7 +313,7 @@ class _LIBCPP_TEMPLATE_VIS __format_to_n_buffer_base<_OutIt, _CharT, true> {
_LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer_base(_OutIt __out_it, _Size __n)
: __output_(_VSTD::__unwrap_iter(__out_it), __n, this), __writer_(_VSTD::move(__out_it)) {
if (__n <= 0) [[unlikely]]
- __output_.reset(__storage_.begin(), __storage_.capacity());
+ __output_.reset(__storage_.begin(), __storage_.__buffer_size);
}
_LIBCPP_HIDE_FROM_ABI void flush(_CharT* __ptr, size_t __size) {
@@ -328,7 +327,7 @@ class _LIBCPP_TEMPLATE_VIS __format_to_n_buffer_base<_OutIt, _CharT, true> {
// When the __n <= 0 the constructor already switched the buffers.
if (__size_ == 0 && __ptr != __storage_.begin()) {
__writer_.flush(__ptr, __size);
- __output_.reset(__storage_.begin(), __storage_.capacity());
+ __output_.reset(__storage_.begin(), __storage_.__buffer_size);
}
__size_ += __size;
More information about the libcxx-commits
mailing list