[libcxx-commits] [libcxx] [libc++] Add build flags to optimize <format> and <charconv> for code size. (PR #98003)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 9 23:42:56 PDT 2024


================
@@ -250,29 +250,79 @@ class __basic_format_arg_value {
     __handle __handle_;
   };
 
+  // Visiting a value for formatting is dispatched via a function pointer to prevent
+  // unused formatters from being instantiated. This can lead to significant code size 
+  // reductions on statically linked targets esp. at lower optimization levels.
+
+  void (__basic_format_arg_value::*__format_)(
+      basic_format_parse_context<_CharT>& __parse_ctx, _Context& __ctx, bool __parse) const;
----------------
mordante wrote:

libc++ promises ABI stability to our users and breaking the ABI needs a very good reason. When there is not a very good reason we make these changes in the unstable ABI. So there changes need some `ifdef`s. Before doing that I like to see some numbers so we can evaluate the merits of this change.

https://github.com/llvm/llvm-project/pull/98003


More information about the libcxx-commits mailing list