[libcxx-commits] [libcxx] [RFC][libc++][format] Implements compile-time caching. (PR #132552)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Mar 22 07:56:51 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff dd97324f119af515944b7ec79fe627cfa70d4a2a e02e5bac0bbdd2e62d8cd9d07c2f0e7810b393b9 --extensions cpp,h -- libcxx/test/benchmarks/format/parsing.bench.cpp libcxx/test/std/utilities/format/format.functions/cache.pass.cpp libcxx/include/__format/format_functions.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 98e2d97718..d092561743 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -725,8 +725,7 @@ private:
         break;
 
       switch (__element.__type) {
-      case __element_type::__formatter_std:
-      {
+      case __element_type::__formatter_std: {
         std::__visit_format_arg(
             [&](auto __arg) {
               if constexpr (same_as<decltype(__arg), monostate>)
diff --git a/libcxx/test/std/utilities/format/format.functions/cache.pass.cpp b/libcxx/test/std/utilities/format/format.functions/cache.pass.cpp
index a1d8ced4ae..bd6e07a726 100644
--- a/libcxx/test/std/utilities/format/format.functions/cache.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/cache.pass.cpp
@@ -8,7 +8,6 @@
 // UNSUPPORTED: c++03, c++11, c++14, c++17
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
 
-
 // TODO FMT This test should not require std::to_chars(floating-point)
 // XFAIL: availability-fp_to_chars-missing
 
@@ -16,7 +15,6 @@
 
 // <format>
 
-
 // This is a test for the new caching mechanism.
 
 #include <format>
@@ -84,8 +82,8 @@ static void test() {
   check(SV("FULL:0x0042"), SV("{:#06x}"), 0x42);
   check(SV("FULL:0x0042=answer"), SV("{:#06x}={}"), 0x42, SV("answer"));
 
-//  check(SV("FULL:hello world"), SV("{} world"), String<char>{"hello"});
-//  check(SV("FULL:hello world"), SV("{0:} world"), String<char>{"hello"});
+  //  check(SV("FULL:hello world"), SV("{} world"), String<char>{"hello"});
+  //  check(SV("FULL:hello world"), SV("{0:} world"), String<char>{"hello"});
 
   // TODO TEST WITH ARG EATER
 }

``````````

</details>


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


More information about the libcxx-commits mailing list