[libcxx-commits] [libcxx] 5468dfb - [libc++][format] Use preferred_name attribute.
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Oct 30 03:52:00 PDT 2021
Author: Mark de Wever
Date: 2021-10-30T12:51:56+02:00
New Revision: 5468dfb973c3db70dacc789c83d713e8d7ec0c1e
URL: https://github.com/llvm/llvm-project/commit/5468dfb973c3db70dacc789c83d713e8d7ec0c1e
DIFF: https://github.com/llvm/llvm-project/commit/5468dfb973c3db70dacc789c83d713e8d7ec0c1e.diff
LOG: [libc++][format] Use preferred_name attribute.
This was suggested by @vitaut in D110494.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D112362
Added:
Modified:
libcxx/include/__format/format_context.h
Removed:
################################################################################
diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index 1cb7ee6a49ec3..b4fe5cc7b12c1 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -70,9 +70,28 @@ __format_context_create(
}
#endif
+// TODO FMT Implement [format.context]/4
+// [Note 1: For a given type charT, implementations are encouraged to provide a
+// single instantiation of basic_format_context for appending to
+// basic_string<charT>, vector<charT>, or any other container with contiguous
+// storage by wrapping those in temporary objects with a uniform interface
+// (such as a span<charT>) and polymorphic reallocation. - end note]
+
+using format_context = basic_format_context<back_insert_iterator<string>, char>;
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+using wformat_context = basic_format_context<back_insert_iterator<wstring>, wchar_t>;
+#endif
+
template <class _OutIt, class _CharT>
requires output_iterator<_OutIt, const _CharT&>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_context {
+class
+ // clang-format off
+ _LIBCPP_TEMPLATE_VIS
+ _LIBCPP_AVAILABILITY_FORMAT
+ _LIBCPP_PREFERRED_NAME(format_context)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wformat_context))
+ // clang-format on
+ basic_format_context {
public:
using iterator = _OutIt;
using char_type = _CharT;
@@ -138,18 +157,6 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_context {
#endif
};
-// TODO FMT Implement [format.context]/4
-// [Note 1: For a given type charT, implementations are encouraged to provide a
-// single instantiation of basic_format_context for appending to
-// basic_string<charT>, vector<charT>, or any other container with contiguous
-// storage by wrapping those in temporary objects with a uniform interface
-// (such as a span<charT>) and polymorphic reallocation. - end note]
-
-using format_context = basic_format_context<back_insert_iterator<string>, char>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-using wformat_context = basic_format_context<back_insert_iterator<wstring>, wchar_t>;
-#endif
-
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
#endif //_LIBCPP_STD_VER > 17
More information about the libcxx-commits
mailing list