[libc-commits] [libc] [libc] Character converter skeleton class (PR #143619)

via libc-commits libc-commits at lists.llvm.org
Tue Jun 10 15:41:11 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.cpp libc/src/__support/wchar/character_converter.h libc/src/__support/wchar/mbstate.h libc/src/__support/wchar/utf_ret.h
``````````

</details>

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

``````````diff
diff --git a/libc/src/__support/wchar/character_converter.cpp b/libc/src/__support/wchar/character_converter.cpp
index 139597f9c..8b1378917 100644
--- a/libc/src/__support/wchar/character_converter.cpp
+++ b/libc/src/__support/wchar/character_converter.cpp
@@ -1,2 +1 @@
 
-
diff --git a/libc/src/__support/wchar/character_converter.h b/libc/src/__support/wchar/character_converter.h
index 1800fe16e..b3de5eae9 100644
--- a/libc/src/__support/wchar/character_converter.h
+++ b/libc/src/__support/wchar/character_converter.h
@@ -1,20 +1,20 @@
 
+#include "hdr/types/wchar_t.h"
 #include "src/__support/wchar/mbstate.h"
 #include "src/__support/wchar/utf_ret.h"
-#include "hdr/types/wchar_t.h"
 
 class CharacterConverter {
 private:
-    mbstate_t* state;
+  mbstate_t *state;
 
 public:
-    CharacterConverter();
+  CharacterConverter();
 
-    bool isComplete();
+  bool isComplete();
 
-    int push(char utf8_byte);
-    int push(wchar_t utf32);
+  int push(char utf8_byte);
+  int push(wchar_t utf32);
 
-    utf_ret<char> pop_utf8();
-    utf_ret<wchar_t> pop_utf32();
+  utf_ret<char> pop_utf8();
+  utf_ret<wchar_t> pop_utf32();
 };
diff --git a/libc/src/__support/wchar/mbstate.h b/libc/src/__support/wchar/mbstate.h
index c0af608c3..7ab16177e 100644
--- a/libc/src/__support/wchar/mbstate.h
+++ b/libc/src/__support/wchar/mbstate.h
@@ -2,7 +2,7 @@
 #include "hdr/types/wchar_t.h"
 
 struct mbstate_t {
-    wchar_t partial;
-    unsigned char bits_processed;
-    unsigned char total_bytes;
+  wchar_t partial;
+  unsigned char bits_processed;
+  unsigned char total_bytes;
 };
diff --git a/libc/src/__support/wchar/utf_ret.h b/libc/src/__support/wchar/utf_ret.h
index 533f4cb95..eeaf66762 100644
--- a/libc/src/__support/wchar/utf_ret.h
+++ b/libc/src/__support/wchar/utf_ret.h
@@ -1,6 +1,5 @@
 
-template <typename T>
-struct utf_ret {
-    T out;
-    int error;
+template <typename T> struct utf_ret {
+  T out;
+  int error;
 };

``````````

</details>


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


More information about the libc-commits mailing list