[libcxx-commits] [PATCH] D138052: [libc++][format] Fixes visit_format_arg.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 15 11:44:29 PST 2022


ldionne accepted this revision.
ldionne added inline comments.
This revision is now accepted and ready to land.


================
Comment at: libcxx/include/__format/format_arg.h:277-278
+#  ifndef _LIBCPP_HAS_NO_INT128
+// This function is user obervable, so it must wrap the non-standard types of
+// the "variant" in a handle. See __arg_t for more details.
+template <class _Visitor, class _Context>
----------------



================
Comment at: libcxx/include/__format/format_arg.h:282-294
+  switch (__arg.__type_) {
+  case __format::__arg_t::__i128: {
+    typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__i128_};
+    return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
+  }
+
+  case __format::__arg_t::__u128: {
----------------
That would reduce duplication below?


================
Comment at: libcxx/include/__format/format_functions.h:187
 
+// This function is not user obervable, so it can directly use the non-standard types of the "variant".
 template <class _CharT>
----------------



================
Comment at: libcxx/include/__format/parser_std_format_spec.h:77
+  //          128-bit integrals fail and switch to visit_format_arg.
+  return __visit_format_arg(
       [](auto __arg) -> uint32_t {
----------------
Qualify the call for ADL?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138052/new/

https://reviews.llvm.org/D138052



More information about the libcxx-commits mailing list