[libc-commits] [libc] [libc][NFC] Add LIBC_INLINE and cleanup wchar internals (PR #188856)

via libc-commits libc-commits at lists.llvm.org
Thu Mar 26 14:59:03 PDT 2026


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 origin/main HEAD --extensions h,cpp -- libc/src/__support/wchar/character_converter.h libc/src/__support/wchar/mbrtowc.cpp libc/src/__support/wchar/mbrtowc.h libc/src/__support/wchar/mbsnrtowcs.h libc/src/__support/wchar/string_converter.h libc/src/__support/wchar/wcrtomb.h libc/src/__support/wchar/wcsnrtombs.h --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/libc/src/__support/wchar/character_converter.h b/libc/src/__support/wchar/character_converter.h
index acafec3b6..4da6970f0 100644
--- a/libc/src/__support/wchar/character_converter.h
+++ b/libc/src/__support/wchar/character_converter.h
@@ -42,7 +42,8 @@ private:
   static constexpr int MAX_UTF8_LENGTH = 4;
 
 public:
-  explicit LIBC_INLINE CharacterConverter(mbstate *state_ptr) : state(state_ptr) {}
+  explicit LIBC_INLINE CharacterConverter(mbstate *state_ptr)
+      : state(state_ptr) {}
 
   LIBC_INLINE void clear() {
     state->partial = 0;
diff --git a/libc/src/__support/wchar/mbsnrtowcs.h b/libc/src/__support/wchar/mbsnrtowcs.h
index e96c4291e..50c3fa23a 100644
--- a/libc/src/__support/wchar/mbsnrtowcs.h
+++ b/libc/src/__support/wchar/mbsnrtowcs.h
@@ -23,10 +23,9 @@
 namespace LIBC_NAMESPACE_DECL {
 namespace internal {
 
-LIBC_INLINE static ErrorOr<size_t> mbsnrtowcs(wchar_t *__restrict dst,
-                                              const char **__restrict src,
-                                              size_t max_src_bytes, size_t max_dst_chars,
-                                              mbstate *__restrict ps) {
+LIBC_INLINE static ErrorOr<size_t>
+mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
+           size_t max_src_bytes, size_t max_dst_chars, mbstate *__restrict ps) {
   LIBC_CRASH_ON_NULLPTR(src);
   CharacterConverter char_conv(ps);
   if (!char_conv.isValidState())
diff --git a/libc/src/__support/wchar/string_converter.h b/libc/src/__support/wchar/string_converter.h
index 62fa64b7c..9e76570e1 100644
--- a/libc/src/__support/wchar/string_converter.h
+++ b/libc/src/__support/wchar/string_converter.h
@@ -51,7 +51,7 @@ private:
 
 public:
   LIBC_INLINE StringConverter(const T *s, mbstate *ps, size_t dstlen,
-                  size_t srclen = SIZE_MAX)
+                              size_t srclen = SIZE_MAX)
       : cr(ps), src(s), src_len(srclen), src_idx(0), num_to_write(dstlen) {}
 
   template <typename CharType> LIBC_INLINE ErrorOr<CharType> pop() {

``````````

</details>


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


More information about the libc-commits mailing list