[libc-commits] [libc] [libc] Reworked CharacterConverter isComplete into isFull and isEmpty (PR #144799)

via libc-commits libc-commits at lists.llvm.org
Wed Jun 18 14:42:41 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 cpp,h -- libc/src/__support/wchar/character_converter.cpp libc/src/__support/wchar/character_converter.h libc/src/__support/wchar/mbstate.h libc/test/src/__support/wchar/utf32_to_8_test.cpp libc/test/src/__support/wchar/utf8_to_32_test.cpp
``````````

</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 708af357d..1f81de424 100644
--- a/libc/src/__support/wchar/character_converter.cpp
+++ b/libc/src/__support/wchar/character_converter.cpp
@@ -35,8 +35,7 @@ void CharacterConverter::clear() {
 }
 
 bool CharacterConverter::isFull() {
-  return state->bytes_stored == state->total_bytes &&
-         state->total_bytes != 0;
+  return state->bytes_stored == state->total_bytes && state->total_bytes != 0;
 }
 
 bool CharacterConverter::isEmpty() { return state->bytes_stored == 0; }
@@ -128,8 +127,7 @@ ErrorOr<char8_t> CharacterConverter::pop_utf8() {
   char32_t output;
 
   // Shift to get the next 6 bits from the utf32 encoding
-  const size_t shift_amount =
-      (state->bytes_stored - 1) * ENCODED_BITS_PER_UTF8;
+  const size_t shift_amount = (state->bytes_stored - 1) * ENCODED_BITS_PER_UTF8;
   if (isFull()) {
     /*
       Choose the correct set of most significant bits to encode the length

``````````

</details>


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


More information about the libc-commits mailing list