[libc-commits] [libc] [libc] Template StringConverter pop function to avoid duplicate code (PR #152204)

via libc-commits libc-commits at lists.llvm.org
Tue Aug 5 13:53:33 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 HEAD~1 HEAD --extensions h,cpp -- libc/src/__support/wchar/character_converter.h libc/src/__support/wchar/mbsnrtowcs.h libc/src/__support/wchar/string_converter.h libc/src/__support/wchar/wcsnrtombs.h libc/test/src/__support/wchar/string_converter_test.cpp
``````````

</details>

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

``````````diff
diff --git a/libc/src/__support/wchar/string_converter.h b/libc/src/__support/wchar/string_converter.h
index d1559ef11..5b55c2124 100644
--- a/libc/src/__support/wchar/string_converter.h
+++ b/libc/src/__support/wchar/string_converter.h
@@ -78,7 +78,8 @@ public:
     }
 
     ErrorOr<CharType> out = cr.pop<CharType>();
-    if (out.has_value() && out.value() == 0) // if out isn't null terminator or an error
+    if (out.has_value() &&
+        out.value() == 0) // if out isn't null terminator or an error
       src_len = src_idx;
 
     num_to_write--;

``````````

</details>


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


More information about the libc-commits mailing list